Skip to content

False positive with E1136 unsubscriptable-object for use in or after is None guard #1498

Open
@sam-s

Description

@sam-s

Steps to reproduce

  1. Create file z.py
a = None
while True:
    if a is None or a["1"] == 0:
        a = {"1": 1}
    else:
        break
print("Done")
  1. run pylint z.py

Current behavior

E:  3,20: Value 'a' is unsubscriptable (unsubscriptable-object)

Expected behavior

no errors, no warnings

pylint --version output

pylint 1.7.1, 
astroid 1.5.2
Python 2.7.13 (default, Dec 18 2016, 07:03:39) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Control flowRequires control flow understandingEnhancement ✨Improvement to a componentHelp wanted 🙏Outside help would be appreciated, good for new contributorsHigh priorityIssue with more than 10 reactionsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationNeeds astroid constraint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions