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 crash from unexpected assignment #8839

Merged
merged 4 commits into from
Jul 12, 2023

Conversation

zenlyj
Copy link
Contributor

@zenlyj zenlyj commented Jul 10, 2023

Type of Changes

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

Description

A short fix for a rare case that causes a fatal error, due to illegal attribute access of the AssignAttr node.

From my understanding, the relevant logic is supposed to check for the existence of an assignment that defines and uses the same variable, like x = x. LHS should always be AssignName node.

Closes #8754

@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Merging #8839 (5bdeb08) into main (5bdc221) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8839   +/-   ##
=======================================
  Coverage   95.87%   95.87%           
=======================================
  Files         173      173           
  Lines       18508    18508           
=======================================
  Hits        17744    17744           
  Misses        764      764           
Impacted Files Coverage Ξ”
pylint/checkers/variables.py 97.18% <100.00%> (ΓΈ)

@jacobtylerwalls jacobtylerwalls self-requested a review July 10, 2023 18:32
@jacobtylerwalls jacobtylerwalls added this to the 2.17.5 milestone Jul 10, 2023
@github-actions
Copy link
Contributor

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

This comment was generated for commit 5bdeb08

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

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

Thanks @zenlyj!

@jacobtylerwalls jacobtylerwalls merged commit e71f63b into pylint-dev:main Jul 12, 2023
@github-actions
Copy link
Contributor

The backport to maintenance/2.17.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/2.17.x maintenance/2.17.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/2.17.x
# Create a new branch
git switch --create backport-8839-to-maintenance/2.17.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e71f63b5ec623b5c128891453baf2bea63fa6eff
# Push it to GitHub
git push --set-upstream origin backport-8839-to-maintenance/2.17.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/2.17.x

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

jacobtylerwalls pushed a commit to jacobtylerwalls/pylint that referenced this pull request Jul 12, 2023
jacobtylerwalls added a commit that referenced this pull request Jul 12, 2023
(cherry picked from commit e71f63b)

Co-authored-by: Zen Lee <53538590+zenlyj@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported Crash πŸ’₯ A bug that makes pylint crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting the identical name between an attribute and a variable causes a fatal error
3 participants