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

Inside a sys.version_info guard, unexpected-keyword-arg returns error for version-specific keyword arg #9622

Open
eli-schwartz opened this issue May 14, 2024 · 1 comment
Labels
Control flow Requires control flow understanding Needs astroid update Needs an astroid update (probably a release too) before being mergable

Comments

@eli-schwartz
Copy link

Bug description

# pylint: disable=missing-module-docstring
# pylint: disable=multiple-imports

import shutil, sys

if sys.version_info >= (3, 13):
    shutil.chown('/tmp/doesntexist', 222, 222, follow_symlinks=False)
else:
    shutil.chown('/tmp/doesntexist', 222, 222)

Configuration

No response

Command used

pylint /tmp/testme.py

Pylint output

************* Module testme
/tmp/testme.py:7:4: E1123: Unexpected keyword argument 'follow_symlinks' in function call (unexpected-keyword-arg)

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

Expected behavior

To not see an error? :D

Either pylint should not try to validate keyword arguments it cannot validate (because it can't know what keyword arguments are going to run inside a sys.version_info check) or it should only check the branch it detects is suitable for the version of python it's implemented under.

Pylint version

pylint 3.1.1
astroid 3.1.0
Python 3.11.9 (main, Apr 27 2024, 23:35:49) [GCC 13.2.1 20240210]

OS / Environment

Gentoo Linux

Additional dependencies

No response

@eli-schwartz eli-schwartz added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label May 14, 2024
@Pierre-Sassoulas
Copy link
Member

Similar to #7240 / #9610, we need better sys guard comprehension in astroid

@Pierre-Sassoulas Pierre-Sassoulas added Control flow Requires control flow understanding Needs astroid update Needs an astroid update (probably a release too) before being mergable and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Control flow Requires control flow understanding Needs astroid update Needs an astroid update (probably a release too) before being mergable
Projects
None yet
Development

No branches or pull requests

2 participants