FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-119180: Alternative approach to metaclass annotations: never use the dict by JelleZijlstra · Pull Request #120816 · python/cpython · GitHub

/ cpython Public

gh-119180: Alternative approach to metaclass annotations: never use the dict - #120816

Closed
JelleZijlstra wants to merge 1 commit into
python:mainfrom
JelleZijlstra:pep649-nodict
Closed

gh-119180: Alternative approach to metaclass annotations: never use the dict#120816
JelleZijlstra wants to merge 1 commit into
python:mainfrom
JelleZijlstra:pep649-nodict

Conversation

JelleZijlstra commented Jun 21, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Like #120719, this is an experimental way to fix the issues discussed in python/peps#3847.

This PR takes the approach of "never use the class dict". Instead, we repurpose the unused tp_cache field to hold annotation information. It can hold any of:

  • NULL: the class has no annotations
  • a dict: the class has __annotations__, but no __annotate__
  • a callable: the class has only __annotate__
  • a tuple: the class has both annotate and annotations

Copy link
Copy Markdown
Member Author

We'll go with #122074.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL