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 false-positive used-before-assignment in function returns #4307

Merged
merged 1 commit into from
Apr 7, 2021
Merged

Fix false-positive used-before-assignment in function returns #4307

merged 1 commit into from
Apr 7, 2021

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Apr 6, 2021

Steps

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature or an important bug fix, add a What's New entry in doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Description

This MR addresses a false-positive that occurred for assignment expressions in function returns.
The following is valid and should not raise an used-before-assignment error.

def func():
    return f'The number {(count := 4)} ' \
           f'is equal to {count}'

This is a followup to #4253

Type of Changes

Type
🐛 Bug fix

Related Issue

Closes #4301

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.593% when pulling 44b8e6c on cdce8p:fix-assignment-expressions into 0b250de on PyCQA:master.

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.

👍

@Pierre-Sassoulas Pierre-Sassoulas merged commit 628c266 into pylint-dev:master Apr 7, 2021
@cdce8p cdce8p deleted the fix-assignment-expressions branch April 7, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive used-before-assignment on different line returns
3 participants