global/local syntax errors not caught

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

Nobody has claimed this yet.

Assessment

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

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.

Description

enhancement help wanted

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.

Dominant language
Python
Stars
1.5k
Forks
207
Avg merge
4m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from PyCQA/pyflakes

All issues in PyCQA/pyflakes

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.