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

unnecessary-ellipsis checker: AstroidError with list in dict (Could not find list in dict's children) #6037

Closed
The-Compiler opened this issue Mar 29, 2022 · 0 comments · Fixed by #6038
Labels
Crash 💥 A bug that makes pylint crash
Milestone

Comments

@The-Compiler
Copy link
Contributor

The-Compiler commented Mar 29, 2022

Bug description

# pylint: disable=missing-module-docstring
x = {'a': [...]}

leads to an AstroidError.

I bisected this to 78eed6a, part of #5470 ("New checker - Detect use of unnecessary ellipsis").

Configuration

No response

Command used

pylint repro3.py

Pylint output

Exception on node <Const.Ellipsis l.2 at 0x7fb5c8bd45e0> in file '/home/florian/proj/pylint/repro3.py'
Traceback (most recent call last):
  File "/home/florian/proj/pylint/pylint/pylint/utils/ast_walker.py", line 72, in walk
    callback(astroid)
  File "/home/florian/proj/pylint/pylint/pylint/checkers/ellipsis_checker.py", line 38, in visit_const
    len(node.parent.parent.child_sequence(node.parent)) > 1
  File "/home/florian/proj/pylint/astroid/astroid/nodes/node_ng.py", line 397, in child_sequence
    raise AstroidError(msg % (repr(child), repr(self)))
astroid.exceptions.AstroidError: Could not find <List.list l.2 at 0x7fb5c8bd4580> in <Dict.dict l.2 at 0x7fb5c8bd77c0>'s children
************* Module repro3
repro3.py:1:0: F0002: repro3.py: Fatal error while checking 'repro3.py'. Please open an issue in our bug tracker so we address this. [...]

Expected behavior

No crash, and probably no error either.

Pylint version

pylint 2.13.2
astroid 2.11.2
Python 3.8.12 (default, Mar  3 2022, 18:19:28) 
[GCC 11.2.0]

(environment in which I originally encountered the bug - output above is from a git install of both astroid and pylint)

OS / Environment

Archlinux

Additional dependencies

No response

@The-Compiler The-Compiler added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 29, 2022
The-Compiler added a commit to qutebrowser/qutebrowser that referenced this issue Mar 29, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 29, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.4 milestone Mar 29, 2022
mbyrnepr2 pushed a commit to mbyrnepr2/pylint that referenced this issue Mar 29, 2022
mbyrnepr2 pushed a commit to mbyrnepr2/pylint that referenced this issue Mar 29, 2022
Pierre-Sassoulas added a commit that referenced this issue Mar 30, 2022
When an ellipsis is used inside of a list or inside a container

Closes #6037

Co-authored-by: Mark Byrne <mark.byrne@rabobank.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Pierre-Sassoulas added a commit that referenced this issue Mar 31, 2022
When an ellipsis is used inside of a list or inside a container

Closes #6037

Co-authored-by: Mark Byrne <mark.byrne@rabobank.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
twigleingrid pushed a commit to twigleingrid/qutebrowser that referenced this issue May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants