Skip to content
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

TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' #146

Closed
asottile opened this issue Apr 3, 2021 · 2 comments
Closed

Comments

@asottile
Copy link
Member

asottile commented Apr 3, 2021

In GitLab by @bnomis on Aug 23, 2016, 20:33

The attached file causes flake8 to crash with the error

TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

flake8 installed via pip

Python 2.7.11
pip 8.1.2 from /Users/rcxue/venv/lib/python2.7/site-packages (python 2.7)
setuptools 26.0.0
flake8 3.0.4 (mccabe: 0.5.2, pyflakes: 1.2.3, pycodestyle: 2.0.0) CPython 2.7.11 on Darwin

pyflake-test.py

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @sigmavirus24 on Aug 25, 2016, 05:14

So this can be more simply reproduced with

foo(
    'a'='b'
)

Notice the quotes around the keyword. I tested invalid syntax on Flake8 and didn't run across this bug it seems the AST library behaves different in some cases. Sorry for this. It'll be fixed up in the next release.

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @martyanov on Sep 15, 2016, 06:06

I get the same error with this code:

from somepackage import one, two, three,

Notice the trailing comma. Is it covered by the changes?

@asottile asottile closed this as completed Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant