Skip to content

Undefined name: 'commandline' --> 'cmd' #13038

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

Merged
merged 1 commit into from
Jun 3, 2019
Merged

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented May 1, 2019

The undefined variable commandline is used but is never defined. cmd is defined on line 1529 and is used on 1534. @ned-deily Your review please.

flake8 testing of https://github.com/python/cpython on Python 3.7.1

$ flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics

./Mac/BuildScript/build-installer.py:1272:17: F821 undefined name 'build_time_vars'
    for k, v in build_time_vars.items():
                ^
./Mac/BuildScript/build-installer.py:1543:50: F821 undefined name 'commandline'
        raise RuntimeError("command failed: %s"%(commandline,))
                                                 ^

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

The ___undefined variable___ __commandline__ is used but is never defined.  __cmd__ is defined on line 1529 and is used on 1534. @ned-deily Your review please.

[flake8](http://flake8.pycqa.org) testing of https://github.com/python/cpython on Python 3.7.1

$ __flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics__
```
./Mac/BuildScript/build-installer.py:1272:17: F821 undefined name 'build_time_vars'
    for k, v in build_time_vars.items():
                ^
./Mac/BuildScript/build-installer.py:1543:50: F821 undefined name 'commandline'
        raise RuntimeError("command failed: %s"%(commandline,))
                                                 ^
```
__E901,E999,F821,F822,F823__ are the "_showstopper_" [flake8](http://flake8.pycqa.org) issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
Copy link
Member

@tirkarthi tirkarthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@ned-deily ned-deily self-assigned this May 13, 2019
Copy link
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this, @cclauss!

@miss-islington
Copy link
Contributor

Thanks @cclauss for the PR, and @ned-deily for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 3, 2019
)

(cherry picked from commit d337169)

Co-authored-by: cclauss <cclauss@me.com>
@bedevere-bot
Copy link

GH-13766 is a backport of this pull request to the 3.7 branch.

@bedevere-bot
Copy link

GH-13767 is a backport of this pull request to the 2.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 3, 2019
)

(cherry picked from commit d337169)

Co-authored-by: cclauss <cclauss@me.com>
miss-islington added a commit that referenced this pull request Jun 3, 2019
(cherry picked from commit d337169)

Co-authored-by: cclauss <cclauss@me.com>
miss-islington added a commit that referenced this pull request Jun 3, 2019
(cherry picked from commit d337169)

Co-authored-by: cclauss <cclauss@me.com>
@cclauss cclauss deleted the patch-1 branch June 3, 2019 03:50
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants