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

Merged
merged 1 commit into from
Aug 6, 2025

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

This comment has been minimized.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

LGTM, but blocked by preliminary MRs.

@jacobtylerwalls jacobtylerwalls removed the Blocked 🚧 Blocked by a particular issue label Jul 28, 2025
@cdce8p cdce8p force-pushed the 3.14-deferred-annotations branch from 379ab07 to d452621 Compare August 5, 2025 20:26
Copy link

codecov bot commented Aug 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.86%. Comparing base (fccbf98) to head (e359cb9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10381   +/-   ##
=======================================
  Coverage   95.86%   95.86%           
=======================================
  Files         176      176           
  Lines       19155    19165   +10     
=======================================
+ Hits        18363    18373   +10     
  Misses        792      792           
Files with missing lines Coverage Δ
pylint/checkers/typecheck.py 96.12% <100.00%> (+0.01%) ⬆️
pylint/checkers/variables.py 97.29% <100.00%> (+<0.01%) ⬆️
pylint/extensions/typing.py 97.81% <100.00%> (+0.04%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This comment has been minimized.

@cdce8p cdce8p force-pushed the 3.14-deferred-annotations branch from d452621 to e359cb9 Compare August 5, 2025 23:28
Copy link
Contributor

github-actions bot commented Aug 5, 2025

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

This comment was generated for commit e359cb9

@cdce8p cdce8p marked this pull request as ready for review August 6, 2025 01:49
@cdce8p
Copy link
Member Author

cdce8p commented Aug 6, 2025

This PR would is ready now. Even without 3.14 in CI yet, this could be helpful to move #10467 forward. Tested the functional tests locally with 3.14.0rc1. The remaining issues are unrelated to the changes here.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Really nice ! Let's merge before the 3.14 PR as you said.

@cdce8p cdce8p merged commit ba26b71 into pylint-dev:main Aug 6, 2025
40 checks passed
@cdce8p cdce8p deleted the 3.14-deferred-annotations branch August 6, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
3 participants