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

Bad operand type for unary -: NoneType #1787

Closed
fepegar opened this issue Dec 20, 2017 · 2 comments
Closed

Bad operand type for unary -: NoneType #1787

fepegar opened this issue Dec 20, 2017 · 2 comments
Labels
Control flow Requires control flow understanding Duplicate 🐫 Duplicate of an already existing issue

Comments

@fepegar
Copy link

fepegar commented Dec 20, 2017

Steps to reproduce

Run pylint on a file with this code:

"""x"""
a = None
if a is None:
    a = 1
b = -a

Current behavior

Get error bad operand type for unary -: NoneType at line 5.

Expected behavior

Get no errors, since a is always == 1.

pylint --version output

pylint 1.7.4,
astroid 1.5.3
Python 3.6.3 |Anaconda custom (64-bit)| (default, Nov  8 2017, 18:10:31)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
@rogalski rogalski added the Control flow Requires control flow understanding label Dec 21, 2017
@PhilippSelenium
Copy link

Looks like a duplicate of #1472

@Pierre-Sassoulas Pierre-Sassoulas added Needs PR This issue is accepted, sufficiently specified and now needs an implementation Duplicate 🐫 Duplicate of an already existing issue and removed Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Jun 30, 2022
@Pierre-Sassoulas
Copy link
Member

You're right @PhilippSelenium. We have a few dozen of issues concerning control-flow, but this one is an exact match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Control flow Requires control flow understanding Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

4 participants