Skip to content

Fix 3.11 test#1558

Merged
cdce8p merged 1 commit intopylint-dev:mainfrom
cdce8p:fix-311
May 13, 2022
Merged

Fix 3.11 test#1558
cdce8p merged 1 commit intopylint-dev:mainfrom
cdce8p:fix-311

Conversation

@cdce8p
Copy link
Copy Markdown
Member

@cdce8p cdce8p commented May 13, 2022

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 assignment

def __exit__(self, typ, value, traceback):
    ...
    exc.__traceback__ = traceback

Previously, 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 in contextlib 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

Issue with reassigned __traceback__ attribute.
In some cases it can be uninferable now.

Ref: pylint-dev#1551
@cdce8p cdce8p added this to the 2.12.0 milestone May 13, 2022
Copy link
Copy Markdown
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.

Make sense, I'm not sure we'll even get regression in pylint for this.

@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 2321874776

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.09%) to 91.807%

Totals Coverage Status
Change from base Build 2320315092: 0.09%
Covered Lines: 9189
Relevant Lines: 10009

💛 - Coveralls

@cdce8p cdce8p marked this pull request as ready for review May 13, 2022 21:35
@cdce8p
Copy link
Copy Markdown
Member Author

cdce8p commented May 13, 2022

Make sense, I'm not sure we'll even get regression in pylint for this.

I don't think so either. We can keep it in mind though if something does come up.

--
/CC: @DanielNoord @jacobtylerwalls Just FYI

@cdce8p cdce8p merged commit fb31eed into pylint-dev:main May 13, 2022
@cdce8p cdce8p deleted the fix-311 branch May 13, 2022 21:37
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.

Test issue with 3.11

3 participants