Skip to content
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

Handle assert_never() when imported from typing_extensions #9782

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Closes #9780

@jacobtylerwalls jacobtylerwalls added False Positive 🦟 A message is emitted but nothing is wrong with the code backport maintenance/3.3.x labels Jul 9, 2024
@jacobtylerwalls jacobtylerwalls added this to the 3.2.6 milestone Jul 9, 2024

This comment has been minimized.

Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 95.81%. Comparing base (52fe657) to head (3ace500).
Report is 128 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #9782   +/-   ##
=======================================
  Coverage   95.81%   95.81%           
=======================================
  Files         174      174           
  Lines       18860    18860           
=======================================
+ Hits        18070    18071    +1     
+ Misses        790      789    -1     
Files with missing lines Coverage Ξ”
pylint/checkers/variables.py 97.23% <100.00%> (+0.07%) ⬆️

This comment has been minimized.

DanielNoord
DanielNoord previously approved these changes Jul 9, 2024
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.

Γ‰lΓ©gant fix, I like when we remove complexity and fix bugs at the same time it's surprisingly often happening too. Just a nit.


from pylint.constants import PY311_PLUS

if PY311_PLUS:
Copy link
Member

Choose a reason for hiding this comment

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

I think we should use sys.version_info directly here. Importing from pylint create coupling so more maintenance work when we drop python 3.11 and more importantely code in the wild will never import out internal constants so it makes functional tests less likely to be representative of real code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why is it Less maintenance?

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas Jul 9, 2024

Choose a reason for hiding this comment

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

We'll have to modify this when we drop python 3.11 and the constant does not exists anymore, right ?

Copy link
Member Author

@jacobtylerwalls jacobtylerwalls Jul 9, 2024

Choose a reason for hiding this comment

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

Yes, but I was suggesting it was the same whether we use the constant or the version guard. The last times we dropped versions we also removed version guards.

Copy link
Member

Choose a reason for hiding this comment

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

This is a functional test, I don't think functional test should look like internal pylint code. However it's not really important, let's move on

Copy link
Contributor

github-actions bot commented Jul 9, 2024

πŸ€– According to the primer, this change has no effect on the checked open source code. πŸ€–πŸŽ‰

This comment was generated for commit 3ace500

@Pierre-Sassoulas Pierre-Sassoulas merged commit a48cd4c into main Jul 12, 2024
40 checks passed
@Pierre-Sassoulas Pierre-Sassoulas deleted the assert-never-typing-ext branch July 12, 2024 10:09
Copy link
Contributor

The backport to maintenance/3.2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-maintenance/3.2.x maintenance/3.2.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/3.2.x
# Create a new branch
git switch --create backport-9782-to-maintenance/3.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a48cd4c6a872b6565bc58030b74585812f327f36
# Push it to GitHub
git push --set-upstream origin backport-9782-to-maintenance/3.2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/3.2.x

Then, create a pull request where the base branch is maintenance/3.2.x and the compare/head branch is backport-9782-to-maintenance/3.2.x.

jacobtylerwalls added a commit to jacobtylerwalls/pylint that referenced this pull request Jul 12, 2024
Pierre-Sassoulas pushed a commit that referenced this pull request Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport maintenance/3.3.x False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

possibly-used-before-assignment does not treat assert_never the same when imported from typing_extensions
3 participants