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 crash in super-init-not-called checker #6043

Merged
merged 7 commits into from Mar 31, 2022

Conversation

DanielNoord
Copy link
Collaborator

  • 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.

Type of Changes

Type
🐛 Bug fix

Description

Closes #6027.

Should have never put that comment there...

@DanielNoord DanielNoord added Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer Regression Crash 💥 A bug that makes pylint crash labels Mar 29, 2022
@DanielNoord DanielNoord added this to the 2.13.4 milestone Mar 29, 2022
@coveralls
Copy link

coveralls commented Mar 29, 2022

Pull Request Test Coverage Report for Build 2069291873

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • 23 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.003%) to 94.215%

Files with Coverage Reduction New Missed Lines %
pylint/checkers/variables.py 23 96.51%
Totals Coverage Status
Change from base Build 2067203898: 0.003%
Covered Lines: 15439
Relevant Lines: 16387

💛 - Coveralls

@DanielNoord
Copy link
Collaborator Author

DanielNoord commented Mar 29, 2022

Uhm.. Does pypy support ctypes?

Copy link
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.

Maybe we need to forbid the use of infer accross all the pylint codebase, there's no way we're not going to get a crash eventuellay with the diversity of code pylint is going to be run on.

pylint/checkers/classes/class_checker.py Show resolved Hide resolved
ChangeLog Outdated Show resolved Hide resolved
@Pierre-Sassoulas
Copy link
Member

We might need to do

[testoptions]
except_implementations=PyPy

What do you think @DanielNoord ?

@DanielNoord
Copy link
Collaborator Author

We might need to do

[testoptions]
except_implementations=PyPy

What do you think @DanielNoord ?

I mean we could, but I don't know why this doesn't work on PyPy. I don't know the ctypes module...

@jacobtylerwalls
Copy link
Member

Looks like the PyPy behavior is correct -- super's init is not being called, so the test file should have a # [super-init-not-called], but because astroid was raising InferenceError, it wasn't working for CPython -- which is good for our present purposes -- we want to test that no crash happens on an inference failure. So maybe a second file with the correct message for PyPy would do it?

@DanielNoord
Copy link
Collaborator Author

I guess raising if we can't infer will lead to more issues right?

@Pierre-Sassoulas
Copy link
Member

I guess raising if we can't infer will lead to more issues right?

Yes I think we should prefer a false negative always when we're not sure.

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
@DanielNoord DanielNoord merged commit 671126a into pylint-dev:main Mar 31, 2022
@DanielNoord DanielNoord deleted the crash branch March 31, 2022 06:49
@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Mar 31, 2022
Pierre-Sassoulas added a commit that referenced this pull request Mar 31, 2022
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported Crash 💥 A bug that makes pylint crash Regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'_CData' not found in <ClassDef.Union l.None at 0x7fb308fdb650>.
4 participants