[issue37922] inspect.getsource returns wrong class definition when multiple class definitions share the same name (but are defined in different scopes)

2019-08-22 Thread Leonard Truong
New submission from Leonard Truong : Here's a case where `inspect.getsource` returns the wrong class definition when a file contains multiple class definitions with the same name. This pattern is valid runtime behavior when the class definitions are inside different scopes (e.g. a fa

[issue37922] inspect.getsource returns wrong class definition when multiple class definitions share the same name (but are defined in different scopes)

2019-08-22 Thread Leonard Truong
Leonard Truong added the comment: Turns out this is a documented issue in the source code: https://github.com/python/cpython/blob/3.7/Lib/inspect.py#L794-L796 -- ___ Python tracker <https://bugs.python.org/issue37