New submission from Taylor Robie <taylor.aiken.ro...@gmail.com>:
Consider the following: ``` import re class MyClass(object): def re(self): pass def foo(self, m: re.Match): pass ``` Even though `re` and `MyClass.re` are distinct namespaces, the type annotation misses that fact (presumably there is an issue with how it is parsing the AST) and attempts to access MyClass.re.Match, resulting in: `AttributeError: 'function' object has no attribute 'Match'` Commenting out the definition of `MyClass.re` or reversing the definition order resolves the issue. ---------- components: Interpreter Core messages: 368635 nosy: robieta priority: normal severity: normal status: open title: AttributeError from type annotation type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40595> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com