Skip to content

gh-137226: Fix behavior of ForwardRef.evaluate with type_params #137227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Jul 30, 2025

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.

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.
Copy link
Member

@Yhg1s Yhg1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a domain expert but this seems correct, if kludgy, to me. (To be honest, it's not more of a kludge than the old implementation.)

@JelleZijlstra
Copy link
Member Author

Thanks for reviewing! I think the annotationlib code is less kludgy; the typing code is more kludgy but that's for compatibility with old get_type_hints() behavior.

@JelleZijlstra JelleZijlstra merged commit 089a324 into python:main Aug 13, 2025
45 checks passed
@miss-islington-app
Copy link

Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@JelleZijlstra JelleZijlstra deleted the annolib-type-params branch August 13, 2025 13:47
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 13, 2025
…pythonGH-137227)

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.
(cherry picked from commit 089a324)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Aug 13, 2025

GH-137709 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Aug 13, 2025
hugovk pushed a commit that referenced this pull request Aug 13, 2025
GH-137227) (#137709)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
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.

2 participants