PyCQA / PyCQA/pyflakes

global/local syntax errors not caught

Open
#249 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Original report by asmeurer (@asmeurer?) on Launchpad:


This is perhaps a bit obscure, but here's a class of syntax errors that aren't caught by pyflakes

$ cat test.py
def test(x):
    global x
$ pyflakes test.py
$ python test.py
  File "test.py", line 2
    global x
SyntaxError: name 'x' is parameter and global

I'm unsure what the full set of possible errors are here. One would need to check the Python source. I know there are some others relating to the Python 3 "nonlocal" keyword as well.

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

Start by reproducing the test.py example with pyflakes and compare its output with Python's syntax error. Review the Python source for related global and nonlocal errors, then define the complete set that should be reported and add coverage for them. Done means these syntax errors are detected consistently.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.