Merged
Conversation
Issue with reassigned __traceback__ attribute. In some cases it can be uninferable now. Ref: pylint-dev#1551
Pierre-Sassoulas
approved these changes
May 13, 2022
Member
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Make sense, I'm not sure we'll even get regression in pylint for this.
Pull Request Test Coverage Report for Build 2321874776
💛 - Coveralls |
Member
Author
I don't think so either. We can keep it in mind though if something does come up. -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Not the ideal solution I was hoping for tbh, but it should work.
As suspected, the test failure is causes by python/cpython#92202. In particular, inside the
__exit__method there is the following assignmentPreviously, astroid couldn't infer
__traceback__and so defaulted to our fallback method.https://github.com/PyCQA/astroid/blob/fd102d45a3552c00d951a07b02c49d278a7a69a2/astroid/interpreter/objectmodel.py#L644-L648
Now, with we have an assignment, which later gets inferred as
Uninferable. However, that means we don't use the fallback anymore. I haven't quite figured out why an assignment incontextlibis applied to__builtins__.BaseExceptionbut that might be related the initial bootstrapping 🤷🏻♂️Anyway, the test change should work and a fallback to
Uninferableisn't the end of the world IMO.Closes: #1551