Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
Description
Bug report
Python 3.8.13 inherits annotations from a subclass:
Python 3.8.13 (default, Oct 19 2022, 17:54:22) [Clang 12.0.0 ] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license"for more information. >>> class A: ... x: int ... >>> class B(A): ... pass ... >>> print(A.__annotations__){'x': <class 'int'>} >>> print(B.__annotations__){'x': <class 'int'>} >>> print(B.__dict__){'__module__': '__main__', '__doc__': None}Python 3.10.8 does not:
Python 3.10.8 (main, Nov 4 2022, 08:45:18) [Clang 12.0.0 ] on darwin Type "help", "copyright", "credits" or "license"for more information. >>> class A: ... x: int ... >>> class B(A): ... pass ... >>> print(A.__annotations__){'x': <class 'int'>} >>> print(B.__annotations__){} >>> print(B.__dict__){'__module__': '__main__', '__doc__': None, '__annotations__':{}}Can't find anything related to this in the changelogs, release notes, stackoverflow etc. Is this known/expected behaviour?