Skip to content

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Jul 30, 2025

This fixes the two incorrect behaviors flagged in #137228 and more generally makes get_type_hints() lean more into using the owner concept from annotationlib instead of trying to infer globals and locals namespaces itself.

The previous behavior was copied from earlier typing code. It works around the way
typing.get_type_hints passes its namespaces, but I don't think the behavior is logical
or correct.
This fixes the two incorrect behaviors flagged in python#137228 and more generally
makes get_type_hints() lean more into using the owner concept from annotationlib
instead of trying to infer globals and locals namespaces itself.
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