PyCQA / PyCQA/pyflakes

finds mangled globals and freevars undefined/unused

Open
#267 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
Python
Stars
1.5k
Forks
190
Avg merge
8m
Merged PRs (30d)
13

Description

Original report by tagrain on Launchpad:


Please describe how you installed Flake8

Example:

python3 -m venv ~/.virtualenvs/flake8
workon flake8
pip install -U pip setuptools wheel
pip install flake8 flake8-commas

Please provide the exact, unmodified output of flake8 --bug-report

nah

Please describe the problem or feature
flake8 thinks that mangled globals or freevars are undefined in:

def _Ham__spam(value):
     value + ' yes mangling really works like this'

class Ham:
     def foo(self, value):
        return __spam(value)

If this is a bug report, please explain with examples (and example code) what you expected to happen and what actually happened.

I expected __spam to be considered defined, because it is.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the provided Python example through pyflakes and confirm how the mangled global or free variable is reported. Trace the name-resolution path that produces the undefined warning, then add a regression test for the example. Done means the valid mangled name is no longer reported as undefined while genuinely undefined names still are.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.