◐ Shell
reader mode source ↗
Skip to content

bpo-41341: Recursive evaluation of ForwardRef in get_type_hints#21553

Merged
gvanrossum merged 2 commits into
python:masterfrom
wyfo:forwardref_recursive_evaluation
Jul 22, 2020
Merged

bpo-41341: Recursive evaluation of ForwardRef in get_type_hints#21553
gvanrossum merged 2 commits into
python:masterfrom
wyfo:forwardref_recursive_evaluation

Conversation

@wyfo

@wyfo wyfo commented Jul 20, 2020

Copy link
Copy Markdown
Contributor

The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.

https://bugs.python.org/issue41341

The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
@the-knights-who-say-ni

This comment has been minimized.

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

@isidentical This might help moving https://bugs.python.org/issue38605 forward (make from __future__ import annotations the default).

@ambv Assuming we get this to work, what would you think of backporting it to 3.9, even though beta5 is already released? On the one hand it's awfully late for such a change (and experience with the bpo issue above suggests it's not painful). On the other hand getting the same behavior for forward refs in 3.9 with from __future__ import annotations as it will have in 3.10 (regardless of that import) seems useful.

@isidentical

Copy link
Copy Markdown
Member

@isidentical This might help moving https://bugs.python.org/issue38605 forward (make from future import annotations the default).

I had my own implementations, but I think I am going to rebase because it was kind of a workaround.

@gvanrossum gvanrossum merged commit 653f420 into python:master Jul 22, 2020
@bedevere-bot

Copy link
Copy Markdown

@gvanrossum: Please replace # with GH- in the commit message next time. Thanks!

@gvanrossum

Copy link
Copy Markdown
Member

@ambv @pablogsal can I please have a decision on whether to backport this to 3.9? See my previous comment.

@pablogsal

Copy link
Copy Markdown
Member

@ambv @pablogsal can I please have a decision on whether to backport this to 3.9? See my previous comment.

I think it makes sense, but being this 3.9 this is @ambv's decision

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @wyfo for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 26, 2020
…onGH-21553)

The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
(cherry picked from commit 653f420)

Co-authored-by: wyfo <joperez@hotmail.fr>
@bedevere-bot

Copy link
Copy Markdown

GH-21629 is a backport of this pull request to the 3.9 branch.

miss-islington added a commit that referenced this pull request Jul 26, 2020
…1553)

The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
(cherry picked from commit 653f420)

Co-authored-by: wyfo <joperez@hotmail.fr>
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Aug 20, 2020
…on#21553)

The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
…on#21553)

The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
johnandersen777 pushed a commit to johnandersen777/dffml that referenced this pull request Jun 2, 2022
…f or str

Related: python/cpython#21553 (comment)
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
johnandersen777 pushed a commit to johnandersen777/dffml that referenced this pull request Jun 23, 2022
…f or str

Related: python/cpython#21553 (comment)
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
johnandersen777 pushed a commit to johnandersen777/dffml that referenced this pull request Jun 23, 2022
…f or str

Related: python/cpython#21553 (comment)
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
johnandersen777 pushed a commit to intel/dffml that referenced this pull request Jul 7, 2022
…f or str

Related: python/cpython#21553 (comment)
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
johnandersen777 pushed a commit to intel/dffml that referenced this pull request Jul 7, 2022
…f or str

Related: python/cpython#21553 (comment)
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
hauntsaninja pushed a commit to python/typeshed that referenced this pull request Aug 24, 2022
johnandersen777 pushed a commit to johnandersen777/dffml that referenced this pull request Jan 5, 2023
…f or str

Related: python/cpython#21553 (comment)
Signed-off-by: John Andersen <johnandersenpdx@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.

8 participants