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 incontextlib
is applied to__builtins__.BaseException
but that might be related the initial bootstrapping 🤷🏻♂️Anyway, the test change should work and a fallback to
Uninferable
isn't the end of the world IMO.Closes: #1551