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

Exception thrown when checking code that passes an integer mode= to open #6414

Closed
yilei opened this issue Apr 20, 2022 · 0 comments · Fixed by #6415
Closed

Exception thrown when checking code that passes an integer mode= to open #6414

yilei opened this issue Apr 20, 2022 · 0 comments · Fixed by #6415
Labels
Crash 💥 A bug that makes pylint crash
Milestone

Comments

@yilei
Copy link
Contributor

yilei commented Apr 20, 2022

Bug description

"""."""

# pylint: disable=consider-using-with


open('foo', mode=2)

Command used

pylint t.py

Pylint output

************* Module t
~/tmp/t.py:6:0: W1501: "2" is not a valid mode for open. (bad-open-mode)
Exception on node <Call l.6 at 0x7fcce79d8190> in file '~/tmp/t.py'
Traceback (most recent call last):
  File "~/.pyenv/versions/3.9.10/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 72, in walk
    callback(astroid)
  File "~/.pyenv/versions/3.9.10/lib/python3.9/site-packages/pylint/checkers/stdlib.py", line 534, in visit_call
    self._check_open_encoded(node, inferred.root().name)
  File "~/.pyenv/versions/3.9.10/lib/python3.9/site-packages/pylint/checkers/stdlib.py", line 633, in _check_open_encoded
    and "b" not in mode_arg.value
TypeError: argument of type 'int' is not iterable
~/tmp/t.py:1:0: F0001: Fatal error while checking '~/tmp/t.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '~/.cache/pylint/pylint-crash-2022-04-20-11.txt'. (fatal)

---------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: -10.00/10, +10.00)

Expected behavior

No exceptions should be thrown

Pylint version

pylint 2.12.2
astroid 2.9.3
Python 3.9.10 (main, Mar 16 2022, 06:54:08)
[GCC 11.2.0]
@yilei yilei added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Apr 20, 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 Apr 20, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Apr 20, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.8 milestone Apr 20, 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