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

Crash list index out of range #5737

Closed
gh-tsc opened this issue Jan 28, 2022 · 1 comment · Fixed by #5772
Closed

Crash list index out of range #5737

gh-tsc opened this issue Jan 28, 2022 · 1 comment · Fixed by #5772
Labels
Crash 💥 A bug that makes pylint crash
Milestone

Comments

@gh-tsc
Copy link

gh-tsc commented Jan 28, 2022

Bug description

minimal.py containing

e = "aaaa"
a = str(e).split(sep=": ")[-1]

Command used

pylint minimal.py

Pylint output

minimal.py:1: [C0103(invalid-name), ] Constant name "e" doesn't conform to UPPER_CASE naming style ('([^\\W\\da-z][^\\Wa-z]*|__.*__)$' pattern)
Exception on node <Call l.2 at 0x7f1aefe51580> in file '/home/tsc@gatehouse.local/dev/daas-ais-service/minimal.py'
Traceback (most recent call last):
  File "/home/tsc@gatehouse.local/.local/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 75, in walk
    callback(astroid)
  File "/home/tsc@gatehouse.local/.local/lib/python3.8/site-packages/pylint/checkers/refactoring/recommendation_checker.py", line 65, in visit_call
    self._check_use_maxsplit_arg(node)
  File "/home/tsc@gatehouse.local/.local/lib/python3.8/site-packages/pylint/checkers/refactoring/recommendation_checker.py", line 140, in _check_use_maxsplit_arg
    + f"({node.args[0].as_string()}, maxsplit=1)[{subscript_value}]"
IndexError: list index out of range
minimal.py:1: [F0001(fatal), ] Fatal error while checking 'minimal.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/home/tsc@gatehouse.local/.cache/pylint/pylint-crash-2022-01-28-11.txt'.

Expected behavior

Didn't expect any fatal error

Pylint version

pylint 2.12.2
astroid 2.9.3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)

OS / Environment

Ubuntu 20.04

@gh-tsc gh-tsc added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jan 28, 2022
@DanielNoord DanielNoord added Crash 💥 A bug that makes pylint crash and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jan 28, 2022
@gh-tsc
Copy link
Author

gh-tsc commented Jan 28, 2022

After changing the file to:

e = "aaaa"
a = str(e).split(": ")[-1]

Pylint doesn't crash

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.

3 participants