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

Fix a false positive for redefined-outer-name #9678

Merged

Conversation

mbyrnepr2
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
πŸ“œ Docs

Description

Fix a false positive for redefined-outer-name when there is a name defined in an exception-handling block which shares the same name as a local variable that has been defined in a function body.

Closes #9671

…e defined in an exception-handling block which shares the same name as a local variable that has been defined in a function body.

Closes pylint-dev#9671
@mbyrnepr2 mbyrnepr2 added the False Positive 🦟 A message is emitted but nothing is wrong with the code label May 27, 2024
Copy link

codecov bot commented May 27, 2024

Codecov Report

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

Project coverage is 95.82%. Comparing base (6888fde) to head (84f189c).
Report is 149 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #9678   +/-   ##
=======================================
  Coverage   95.82%   95.82%           
=======================================
  Files         174      174           
  Lines       18813    18816    +3     
=======================================
+ Hits        18027    18030    +3     
  Misses        786      786           
Files with missing lines Coverage Ξ”
pylint/checkers/variables.py 97.36% <100.00%> (+<0.01%) ⬆️

do not emit ``redefined-outer-name`` if that is the case.

This comment has been minimized.

Copy link
Contributor

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

This comment was generated for commit 84f189c

@mbyrnepr2 mbyrnepr2 marked this pull request as ready for review May 30, 2024 08:52
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

πŸš€

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.

πŸ‘Œ straight to 3.2.3 !

@Pierre-Sassoulas Pierre-Sassoulas merged commit 57ae027 into pylint-dev:main Jun 4, 2024
46 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 4, 2024
When there is a name defined in an exception-handling block which shares the same name
as a local variable that has been defined in a function body. Check if the outer node is in the
scope of an exception assignment and do not emit ``redefined-outer-name`` if that is the case.

Closes #9671

(cherry picked from commit 57ae027)
Pierre-Sassoulas pushed a commit that referenced this pull request Jun 4, 2024
When there is a name defined in an exception-handling block which shares the same name
as a local variable that has been defined in a function body. Check if the outer node is in the
scope of an exception assignment and do not emit ``redefined-outer-name`` if that is the case.

Closes #9671

(cherry picked from commit 57ae027)

Co-authored-by: Mark Byrne <[email protected]>
@mbyrnepr2 mbyrnepr2 deleted the 9671-fp-redefined-outer-name branch June 5, 2024 05:58
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.

False positive redefined-outer-name for variables bound to the exception in except clauses
3 participants