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 W0602 #195

Closed
pylint-bot opened this issue Apr 16, 2014 · 3 comments
Closed

False positive for W0602 #195

pylint-bot opened this issue Apr 16, 2014 · 3 comments
Labels
Bug 🪲 Checkers Related to a checker

Comments

@pylint-bot
Copy link

Originally reported by: the mulhern (BitBucket: the_mulhern)


Mini-example:

#!python

path = None

def junk():
    global path
    from os import path

def junk2():
    print("%s" % path)

Pylint reports W0602 (global-variable-not-assigned) for the statement "global path".

But actually, path is assigned to by means of the import statement as can be seen by the interpreter interaction below:

from junk import *
junk2()
None
junk()
junk2()
<module 'posixpath' from '/usr/lib64/python2.7/posixpath.pyc'>

Without the global statement the second invocation of junk2() would print None, just like the first.


@pylint-bot
Copy link
Author

Original comment by the mulhern (BitBucket: the_mulhern):


The interpreter interaction from previous comment, better formatted:

#!python

>>> from junk import *
>>> junk2()
None
>>> junk()
>>> junk2()
<module 'posixpath' from '/usr/lib64/python2.7/posixpath.pyc'>

@pylint-bot
Copy link
Author

Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):


Removing version: 1.1 (automated comment)

@pylint-bot
Copy link
Author

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


This had the same solving as issue #196.

@pylint-bot pylint-bot added Bug 🪲 Checkers Related to a checker labels Dec 9, 2015
msuozzo pushed a commit to msuozzo/pylint that referenced this issue Feb 18, 2022
Note that the synthtool-generated `.coveragerc` (see pylint-dev#224) does *not* include all changes needed for 100% coverage:  see:

- googleapis/gapic-generator-python#171
- googleapis/gapic-generator-python#437

Closes pylint-dev#92.
Closes pylint-dev#195.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Checkers Related to a checker
Projects
None yet
Development

No branches or pull requests

1 participant