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 astroid.Inference error for undefined-variables with len() #4216

Merged
merged 1 commit into from
Mar 8, 2021
Merged

Fix astroid.Inference error for undefined-variables with len() #4216

merged 1 commit into from
Mar 8, 2021

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Mar 8, 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

Wrap node.infer() in try ... except to catch astroid.InferenceError if variable is undefined.
The error seems to be a result of e50d733

--

This could be included in 2.7.3

Type of Changes

Type
🐛 Bug fix

Related Issue

Closes #4215

@cdce8p cdce8p mentioned this pull request Mar 8, 2021
@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 91.429% when pulling 3c09370 on cdce8p:fix-len-as-condition_InferenceError into ba4941b on PyCQA:master.

@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash inference labels Mar 8, 2021
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.7.3 milestone Mar 8, 2021
@Pierre-Sassoulas Pierre-Sassoulas merged commit 0f1245c into pylint-dev:master Mar 8, 2021
@Pierre-Sassoulas
Copy link
Member

Thank you for the quick fix.

@cdce8p cdce8p deleted the fix-len-as-condition_InferenceError branch March 8, 2021 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NameInferenceError
3 participants