Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.14] gh-133960: Improve typing.evaluate_forward_ref (GH-133961)#134663

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

miss-islington
Copy link
Contributor

@miss-islingtonmiss-islington commentedMay 25, 2025
edited by github-actionsbot
Loading

As explained inGH-133960, this removes most of the behavior differences with ForwardRef.evaluate.
The remaining difference is about recursive evaluation of forwardrefs; this is practically useful
in cases where an annotation refers to a type alias that itself is string-valued.

This also improves several edge cases that were previously not handled optimally. For example,
the function now takes advantage of the partial evaluation behavior of ForwardRef.evaluate() to
evaluate more ForwardRefs in the FORWARDREF format.

This alsofixesGH-133959 as a side effect, because the buggy behavior inGH-133959 derives from
evaluate_forward_ref().
(cherry picked from commit57fef27)

Co-authored-by: Jelle Zijlstrajelle.zijlstra@gmail.com


📚 Documentation preview 📚:https://cpython-previews--134663.org.readthedocs.build/

As explained inpythonGH-133960, this removes most of the behavior differences with ForwardRef.evaluate.The remaining difference is about recursive evaluation of forwardrefs; this is practically usefulin cases where an annotation refers to a type alias that itself is string-valued.This also improves several edge cases that were previously not handled optimally. For example,the function now takes advantage of the partial evaluation behavior of ForwardRef.evaluate() toevaluate more ForwardRefs in the FORWARDREF format.This alsofixespythonGH-133959 as a side effect, because the buggy behavior inpythonGH-133959 derives fromevaluate_forward_ref().(cherry picked from commit57fef27)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstraJelleZijlstraenabled auto-merge (squash)May 25, 2025 17:39
@JelleZijlstraJelleZijlstra merged commit9c6d2db intopython:3.14May 25, 2025
44 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JelleZijlstraJelleZijlstraAwaiting requested review from JelleZijlstraJelleZijlstra is a code owner

@AlexWaygoodAlexWaygoodAwaiting requested review from AlexWaygoodAlexWaygood is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@miss-islington@JelleZijlstra

[8]ページ先頭

©2009-2025 Movatter.jp