Skip to content

False Positive for W0602: global-variable-not-assigned #4809

Closed
@SycamoreLeaf

Description

@SycamoreLeaf

Bug description

# pylint: disable=missing-module-docstring,missing-function-docstring
# pylint: disable=invalid-name,import-outside-toplevel
def import_it():
    global argp, namedtuple
    import argparse as argp
    from collections import namedtuple

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module deleteme
deleteme.py:4:4: W0602: Using global for 'namedtuple' but no assignment is done (global-variable-not-assigned)

Expected behavior

Pylint should NOT warn W0602 (global-variable-not-assigned)

Pylint version

pylint 2.9.6
astroid 2.6.6
Python 3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:39:48) 
[GCC 9.3.0]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

Labels

False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions