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 on gethostname in socket module #4302

Closed
dalemyers opened this issue Apr 6, 2021 · 3 comments · Fixed by #5529
Closed

False positive on gethostname in socket module #4302

dalemyers opened this issue Apr 6, 2021 · 3 comments · Fixed by #5529

Comments

@dalemyers
Copy link

dalemyers commented Apr 6, 2021

Steps to reproduce

Create a simple file (or use this zipped example socket_test.zip):

"""Test module."""

import socket

print(socket.gethostname())

Install pylint (you can use the following requirements.txt file to get the latest, or install the pre-release version):

astroid==2.5.2
isort==5.8.0
lazy-object-proxy==1.6.0
mccabe==0.6.1
pylint==2.7.4
toml==0.10.2
wrapt==1.12.1

Run pylint test.py on it.

Current behavior

************* Module test
test.py:5:6: E1101: Module 'socket' has no 'gethostname' member (no-member)

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

Expected behavior

No issues will be found

pylint --version output

Result of pylint --version output:

pylint 3.0.0a1
astroid 2.5.2
Python 3.9.2 (default, Mar 26 2021, 23:22:38)
[Clang 12.0.0 (clang-1200.0.32.29)]

or

pylint 2.7.4
astroid 2.5.2
Python 3.9.2 (default, Mar 26 2021, 23:22:38)
[Clang 12.0.0 (clang-1200.0.32.29)]

Both repro.

Note: Running this on macOS Big Sur

@hippo91
Copy link
Contributor

hippo91 commented Apr 9, 2021

@dalemyers thanks for your report. I do not understand clearly what is the problem here as the Current behavior section is empty.
However when linting the snippet you gave, pylintdoesn't complain about anything.

@dalemyers
Copy link
Author

Updated the current behavior section (I'd accidentally pasted my output in the HTML comment in the template).

Everyone on my team is seeing this same behavior.

Here are the exact steps I took to reproduce on a brand new machine (only took it out of the box yesterday):

  1. Create a new folder somewhere called whatever you like
  2. Create a new python file inside that called "test.py" (this can really be whatever you like as well)
  3. Set the content of that to the example shown above
  4. Create a new virtual environment python3 -m venv venv
  5. Activate the virtual environment source venv/bin/activate
  6. Install pylint python3 -m pip install pylint
  7. Run pylint python3 -m pylint test.py

Python 3.9.4 in this case (repro above was 3.9.2).

@ravisumit33
Copy link

I also can reproduce this issue.
@dalemyers I am facing similar issue #4592 . Can you also reproduce it?

Is it common on Mac OS ?

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.0 milestone Dec 15, 2021
Pierre-Sassoulas added a commit that referenced this issue Dec 15, 2021
Closes #3499
Closes #4302
Closes #4798
Closes #5081
Pierre-Sassoulas added a commit that referenced this issue Dec 19, 2021
Closes #1470
Closes #3499
Closes #4302
Closes #4798
Closes #5081
Pierre-Sassoulas added a commit that referenced this issue Dec 31, 2021
Closes #1470
Closes #3499
Closes #4302
Closes #4798
Closes #5081
Pierre-Sassoulas added a commit that referenced this issue Dec 31, 2021
Closes #1470
Closes #3499
Closes #4302
Closes #4798
Closes #5081
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants