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

Bogus C0202, E0213 warnings when using positional-only parameters (PEP 570) #3230

Closed
scottj97 opened this issue Nov 4, 2019 · 2 comments
Closed

Comments

@scottj97
Copy link

scottj97 commented Nov 4, 2019

Steps to reproduce

Run pylint on the following file:

#!python3
"""Test linting.

This is only intended to test pylint support for python 3.8's
positional-only arguments (PEP 570).
"""


class Foobar:
    """Class for frobulating the Foobar."""

    @classmethod
    def buildme(cls, /, value):
        """Construct object using alternate method."""
        return cls(value).abc

    def runme(self, qrs, /, xyz=None):
        """Do something funcy."""
        if self.abc and qrs and xyz:
            print("found something else")

Current behavior

************* Module run
src/run.py:14:4: C0202: Class method buildme should have 'cls' as first argument (bad-classmethod-argument)
src/run.py:18:4: E0213: Method should have "self" as first argument (no-self-argument)

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

Expected behavior

No warnings.

pylint --version output

pylint 2.5.0-dev1
astroid 2.3.2
Python 3.8.0 (default, Oct 25 2019, 11:21:45) 
[GCC 8.2.0]

I'm running pylint from github at ee8bd98.

Since the pylint README says to use the latest astroid, I tried that too, requiring a change to pylint/__pkginfo__.py to allow the latest version (7aca7d4726c6f6ae8cf720fc95ecc8fb0ad246d5). The bogus warnings were still there.

Related issues

#3161
PyCQA/pep8-naming#122

@PCManticore
Copy link
Contributor

Thanks for the report! This is now fixed in master.

@scottj97
Copy link
Author

scottj97 commented Nov 8, 2019

I confirm this fixes the issues I was seeing. Thanks for the quick patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants