Skip to content

Handle deferred evaluation of annotations in Python 3.14 #10381

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented May 14, 2025

Closes #10149

@cdce8p cdce8p added this to the 4.0.0 milestone May 14, 2025
@cdce8p cdce8p added typing C: used-before-assignment Issues related to 'used-before-assignment' check C: undefined-variable Issues related to 'undefined-variable' check python 3.14 labels May 14, 2025
@cdce8p
Copy link
Member Author

cdce8p commented May 14, 2025

We should wait until we can test 3.14 in CI before merging this.

I also don't really like that we need to duplicate a lot of tests. Maybe we can come up with a better solution for dealing conditional errors in our tests.

@cdce8p cdce8p marked this pull request as draft May 14, 2025 16:08

This comment has been minimized.

@Pierre-Sassoulas
Copy link
Member

Great !

We should wait until we can test 3.14 in CI before merging this.

Agree, so it's Blocked by pylint-dev/astroid#2731 and then the pylint equivalent.

I also don't really like that we need to duplicate a lot of tests. Maybe we can come up with a better solution for dealing conditional errors in our tests.

Maybe time to design something to be able to expect something different according to the version ?
filename.py

something = 1 # [unused-variable|>=3.13,missing-module-docstring]

With filename.3.14.txt for the expected output of 3.14, filename.txt for the default expected output if the interpreter does not have its specific output file...

@Pierre-Sassoulas Pierre-Sassoulas added the Blocked 🚧 Blocked by a particular issue label May 14, 2025
@cdce8p cdce8p force-pushed the 3.14-deferred-annotations branch from 32635df to 8615074 Compare May 14, 2025 23:21
@cdce8p
Copy link
Member Author

cdce8p commented May 14, 2025

I also don't really like that we need to duplicate a lot of tests. Maybe we can come up with a better solution for dealing conditional errors in our tests.

Maybe time to design something to be able to expect something different according to the version ? filename.py

something = 1 # [unused-variable|>=3.13,missing-module-docstring]

With filename.3.14.txt for the expected output of 3.14, filename.txt for the default expected output if the interpreter does not have its specific output file...

Explored something like this in #10382. The diff here would look much better, see 379ab07.

@cdce8p cdce8p force-pushed the 3.14-deferred-annotations branch from 8615074 to 379ab07 Compare May 14, 2025 23:33
Copy link
Contributor

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit 379ab07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked 🚧 Blocked by a particular issue C: undefined-variable Issues related to 'undefined-variable' check C: used-before-assignment Issues related to 'used-before-assignment' check python 3.14 typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.14 annotation evaluation is deferred
2 participants