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

false positive raising-bad-type for value known to be not None #2793

Closed
vlovich opened this issue Mar 5, 2019 · 1 comment · Fixed by #5968
Closed

false positive raising-bad-type for value known to be not None #2793

vlovich opened this issue Mar 5, 2019 · 1 comment · Fixed by #5968
Assignees
Labels
Bug 🪲 Control flow Requires control flow understanding

Comments

@vlovich
Copy link

vlovich commented Mar 5, 2019

Steps to reproduce

  1. cat test.py
class Foo(object):
  def __init__(self):
    self._exc = None

  def fail(self):
    self._exc = Exception("")

  def doit(self):
    if self._exc:
      exc = self._exc
      self._exc = None
      raise exc
  1. pylint -E test.py

Current behavior

************* Module test
test.py:12:6: E0702: Raising NoneType while only classes or instances are allowed (raising-bad-type)

Expected behavior

pylint should be smart enough not to warn about this.

pylint --version output

pylint 2.3.1
astroid 2.2.3
Python 3.7.2 (default, Feb 13 2019, 15:31:10)
[Clang 10.0.0 (clang-1000.11.45.5)]

@PCManticore PCManticore added Bug 🪲 Control flow Requires control flow understanding labels Mar 5, 2019
@PCManticore
Copy link
Contributor

Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Control flow Requires control flow understanding
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants