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

False positive for math sqrt function #4592

Closed
ravisumit33 opened this issue Jun 18, 2021 · 4 comments
Closed

False positive for math sqrt function #4592

ravisumit33 opened this issue Jun 18, 2021 · 4 comments

Comments

@ravisumit33
Copy link

Steps to reproduce

Given a file a.py:

"""
Module to test pylint
"""
from math import sqrt
print(sqrt(4))

Current behavior

Result of pylint a.py:
Screenshot 2021-06-18 at 6 55 54 PM

Expected behavior

pylint should not give error for math.sqrt function

pylint --version output

Result of pylint --version output:

On Stable release

pylint 2.8.3
astroid 2.5.6
Python 3.9.5 (default, May  4 2021, 03:33:11)
[Clang 12.0.0 (clang-1200.0.32.29)]

On preview release

pylint 3.0.0a3
astroid 2.6.0-dev0
Python 3.9.5 (default, May  4 2021, 03:33:11)
[Clang 12.0.0 (clang-1200.0.32.29)]
@Pierre-Sassoulas
Copy link
Member

Hello, thank you for opening the issue, I can't reproduce this problem. What is your operating system and environment ?

@ravisumit33
Copy link
Author

ravisumit33 commented Jun 18, 2021

@Pierre-Sassoulas I am working on Mac OS Catalina in terminal. Installed pylint using pip3 install pylint and got this error.

@ravisumit33
Copy link
Author

This duplicates #1524
I solved it using extension-pkg-allow-list=math in my pylintrc. However, I didn't get c-extension-no-member error rather no-name-in-module error which created the confusion.

@Pierre-Sassoulas
Copy link
Member

Thank you for solving this. You must have a C binding for math on MacOs. I think I never saw the c-extension-no-member myself, half the issue about false positives for no-member and half the questions on stackoverflow could be avoided if c-extension-no-member was working properly because very often the answer is to put it in the extension-pkg-allow-list.

spthm added a commit to spthm/plox that referenced this issue Sep 14, 2021
disallowed-name picks up on 'foo' name used in tests. The rest of the
disallowed names are not something I'd use in src/, anyway.

On macOS the 'math' module apparently has C bindings, and pylint wasn't
correctly seeing math.isnan; c.f. pylint-dev/pylint#4592
spthm added a commit to spthm/plox that referenced this issue Mar 12, 2022
disallowed-name picks up on 'foo' name used in tests. The rest of the
disallowed names are not something I'd use in src/, anyway.

On macOS the 'math' module apparently has C bindings, and pylint wasn't
correctly seeing math.isnan; c.f. pylint-dev/pylint#4592
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants