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

no-argument call to copy.copy() crashes #8774

Closed
jacobtylerwalls opened this issue Jun 13, 2023 · 3 comments · Fixed by #8784
Closed

no-argument call to copy.copy() crashes #8774

jacobtylerwalls opened this issue Jun 13, 2023 · 3 comments · Fixed by #8784
Labels
Crash 💥 A bug that makes pylint crash Good first issue Friendly and approachable by new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Jun 13, 2023

Bug description

from copy import copy
copy()

Configuration

n/a

Command used

pylint a.py

Pylint output

pylint crashed with a ``AstroidError`` and with the following stacktrace:
Traceback (most recent call last):
  File "/Users/user/pylint/pylint/lint/pylinter.py", line 788, in _lint_file
    check_astroid_module(module)
  File "/Users/user/pylint/pylint/lint/pylinter.py", line 1017, in check_astroid_module
    retval = self._check_astroid_module(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/pylint/pylint/lint/pylinter.py", line 1063, in _check_astroid_module
    walker.walk(node)
  File "/Users/user/pylint/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/Users/user/pylint/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/Users/user/pylint/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "/Users/user/pylint/pylint/checkers/stdlib.py", line 563, in visit_call
    self._check_shallow_copy_environ(node)
  File "/Users/user/pylint/pylint/checkers/stdlib.py", line 514, in _check_shallow_copy_environ
    arg = utils.get_argument_from_call(node, position=0)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/pylint/pylint/checkers/utils.py", line 736, in get_argument_from_call
    raise NoSuchArgumentError
pylint.checkers.utils.NoSuchArgumentError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/user/pylint/pylint/lint/pylinter.py", line 752, in _lint_files
    self._lint_file(fileitem, module, check_astroid_module)
  File "/Users/user/pylint/pylint/lint/pylinter.py", line 790, in _lint_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

Expected behavior

no crash

Pylint version

pylint 3.0.0b1
astroid 3.0.0a6-dev0
Python 3.11.2

OS / Environment

No response

Additional dependencies

No response

@jacobtylerwalls jacobtylerwalls added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 13, 2023
@jacobtylerwalls
Copy link
Member Author

Good first issue for someone. Example implementation to follow in #8728.

@jacobtylerwalls jacobtylerwalls added Good first issue Friendly and approachable by new contributors Crash 💥 A bug that makes pylint crash and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 13, 2023
@jacobtylerwalls jacobtylerwalls added this to the 2.17.5 milestone Jun 13, 2023
@jacobtylerwalls jacobtylerwalls added the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Jun 13, 2023
@mustafaelghrib
Copy link

Hi @jacobtylerwalls, I am interested in this issue and would like to work on it, could I know what I need to know before working on it? Thanks

@mustafaelghrib
Copy link

I reproduced it on my machine

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 Good first issue Friendly and approachable by new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants