Skip to content

Defer annotation eval on Python 3.14 #13550

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Jun 21, 2025

Fixes #13549

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 21, 2025
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

well done, thanks

Comment on lines +23 to +24
from annotationlib import Format

Copy link
Member

Choose a reason for hiding this comment

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

i wonder if

Suggested change
from annotationlib import Format
from annotationlib import Format
signature = partial(inspect.signature, annotation_format=Format.STRING)
else:
from inspect import signature

would be sufficient, it may be a bit too much of a code golf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it would work but raise mypy errors as signature isn't explicitly exported.

src/_pytest/nodes.py:31: error: Module "_pytest.compat" does not explicitly export attribute "signature"  [attr-defined]
src/_pytest/fixtures.py:52: error: Module "_pytest.compat" does not explicitly export attribute "signature"  [attr-defined]

That could be resolved with from inspect import signature as signature but at that point we might as well use a dedicated function for it. That will also make it easier to understand what's going on here.

--
@RonnyPfannschmidt Can this PR be backported to 8.4.x in case there is another release before 8.5?

Copy link
Member

Choose a reason for hiding this comment

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

i see, thanks for verifying , let me add the backport label

@RonnyPfannschmidt RonnyPfannschmidt added the backport 8.4.x apply to PRs at any point; backports the changes to the 8.4.x branch label Jun 22, 2025
@cdce8p
Copy link
Contributor Author

cdce8p commented Jun 22, 2025

Anything else left here? The test failures look unrelated to me.

@RonnyPfannschmidt
Copy link
Member

Failures are unrelated
We are responsible for merging soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 8.4.x apply to PRs at any point; backports the changes to the 8.4.x branch bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unresolved annotations shouldn't throw errors on Python 3.14
3 participants