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

Raise when a name is inferred twice with the same context #2238

Merged

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Jul 5, 2023

Type of Changes

Type
🐛 Bug fix

Description

Fixes #2237
Regression in 082774a. "sort of" unreleased, caused in an alpha pre-release (3.0.0a6), so no backport needed.

This was one of the fragile parts I was a little worried about when doing #2171, so I'm not surprised that it regressed.

When trying to assess if this functionality was common enough for a mixin, I was trying to work through whether _infer and _infer_lhs really needed the same decorators or not, and in the process I missed this decorator.

@jacobtylerwalls
Copy link
Member Author

The fact that the pandas example that crashed in the pylint primer relies on this behavior seems like a code smell. We probably should do something like the patch suggested at #2237 (comment), but that would need some more investigation to determine the best place to copy the context.

@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

Merging #2238 (19c1cb7) into main (71f81ee) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2238   +/-   ##
=======================================
  Coverage   92.83%   92.84%           
=======================================
  Files          94       94           
  Lines       10963    10964    +1     
=======================================
+ Hits        10178    10179    +1     
  Misses        785      785           
Flag Coverage Δ
linux 92.64% <100.00%> (+<0.01%) ⬆️
pypy 90.96% <100.00%> (+<0.01%) ⬆️
windows 92.41% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
astroid/nodes/node_classes.py 94.83% <100.00%> (+<0.01%) ⬆️

... and 2 files with indirect coverage changes

@jacobtylerwalls jacobtylerwalls merged commit a7ab088 into pylint-dev:main Jul 6, 2023
@jacobtylerwalls jacobtylerwalls deleted the fix-exhausted-inference branch July 6, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exhausted inference from reused context in 3.0.0a6
2 participants