[issue43746] Weird typing annotation closure behavior

conchylicultor report at bugs.python.org
Fri Apr 9 02:29:43 EDT 2021


conchylicultor <etiennefg.pot at gmail.com> added the comment:

Sure, here is a minimal reproductible example demonstrating the issue:

```
import pathlib


class C:
    pathlib: pathlib.Path = None
```

Which raises:

```
  File "....py", line 5, in C
    pathlib: pathlib.Path = None
AttributeError: 'NoneType' object has no attribute 'Path'
```

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43746>
_______________________________________


More information about the Python-bugs-list mailing list