Skip to content

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Jun 21, 2024

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

@JelleZijlstra
Copy link
Member Author

We'll go with #122074.

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