This causes the correct declaration to be found in some unusual cases that previously failed.
* Names can be used in a function body before their definition, provided that they're defined before the function is called. These weren't found unless declared at module scope.
BUG: 378083
* Class attributes from any enclosing class definition were found in default arguments. Only those from a method's parent class should be found.
* Class or instance attributes were, correctly, not directly visible inside a method body (only with `self.` or similar). They did however hide names from outer contexts.