Title: `__annotations__` are not inherited in 3.10 while they are in 3.8 · Issue #99535 · python/cpython · GitHub
Open Graph Title: `__annotations__` are not inherited in 3.10 while they are in 3.8 · Issue #99535 · python/cpython
X Title: `__annotations__` are not inherited in 3.10 while they are in 3.8 · Issue #99535 · python/cpython
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:...
Open Graph 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 "lic...
X 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"...
Opengraph URL: https://github.com/python/cpython/issues/99535
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`__annotations__` are not inherited in 3.10 while they are in 3.8","articleBody":"# Bug report\r\n\r\nPython 3.8.13 inherits annotations from a subclass:\r\n\r\n```bash\r\nPython 3.8.13 (default, Oct 19 2022, 17:54:22) \r\n[Clang 12.0.0 ] :: Anaconda, Inc. on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n\u003e\u003e\u003e class A:\r\n... x: int\r\n... \r\n\u003e\u003e\u003e class B(A):\r\n... pass\r\n... \r\n\u003e\u003e\u003e print(A.__annotations__)\r\n{'x': \u003cclass 'int'\u003e}\r\n\u003e\u003e\u003e print(B.__annotations__)\r\n{'x': \u003cclass 'int'\u003e}\r\n\u003e\u003e\u003e print(B.__dict__)\r\n{'__module__': '__main__', '__doc__': None}\r\n```\r\n\r\nPython 3.10.8 does not:\r\n\r\n```bash\r\nPython 3.10.8 (main, Nov 4 2022, 08:45:18) [Clang 12.0.0 ] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n\u003e\u003e\u003e class A:\r\n... x: int\r\n... \r\n\u003e\u003e\u003e class B(A):\r\n... pass\r\n... \r\n\u003e\u003e\u003e print(A.__annotations__)\r\n{'x': \u003cclass 'int'\u003e}\r\n\u003e\u003e\u003e print(B.__annotations__)\r\n{}\r\n\u003e\u003e\u003e print(B.__dict__)\r\n{'__module__': '__main__', '__doc__': None, '__annotations__': {}}\r\n```\r\n\r\nCan't find anything related to this in the changelogs, release notes, stackoverflow etc. Is this known/expected behaviour?\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-99990\n* gh-100507\n* gh-100509\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/henrifroese","@type":"Person","name":"henrifroese"},"datePublished":"2022-11-16T14:30:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/99535/cpython/issues/99535"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b6c35fa6-5789-9d1e-c164-6684f0b087a2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7F0:D92A5:46A144:63B020:6968DB3F |
| html-safe-nonce | 03f67dd95b89c180d5c040caf8f7cd9d45c883323aef9c086195320cd24784d5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0YwOkQ5MkE1OjQ2QTE0NDo2M0IwMjA6Njk2OERCM0YiLCJ2aXNpdG9yX2lkIjoiNDM5ODY5MTY3NTgyNjMyNzY3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7a4d7f4ea84b1296d4c3425c7c13b24aa81d396f2ab57e00f33d518ac433487f |
| hovercard-subject-tag | issue:1451711304 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/99535/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8cae4d6565816bd76ee1013ed98cb3d62598ae707bd4bc24a6f33a15e6f5ce61/python/cpython/issues/99535 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8cae4d6565816bd76ee1013ed98cb3d62598ae707bd4bc24a6f33a15e6f5ce61/python/cpython/issues/99535 |
| og:image:alt | 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 "lic... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | henrifroese |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3c4e9f2fc1db52c609205138be6a397cfde4574cb54d53015014de30dd49f27e |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1fb1ea11f8c37dd4dd50347cca70d89824e93788 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width