It selects objects that are inside hidden locked layers.
That’s because you didn’t ask it nicely not to…
objs=[obj for obj in rs.ObjectsByName("name") if rs.IsObjectSelectable(obj)]
Seriously, there are lots of rs methods that will look at the entire file for objects that match the criteria. For example AllObjects() gets everything, no matter if it’s locked, hidden etc. Some methods have a “state” argument that you can add, like ObjectsByType(). But most don’t. So it is something you need to watch out for, because you can actually alter locked and hidden objects without realizing it.