Skip to content

False positive with Python 2 old-style raise statement #11742

Closed
@JukkaL

Description

@JukkaL

This generates an error, even though it's valid at runtime:

raise Exception(), None, None  # First argument must be BaseException subtype

An exception instance is valid if the second object is None: https://docs.python.org/2/reference/simple_stmts.html#the-raise-statement

It looks like #11289 forgot to handle this case.

Since this is a regression and we are close to cutting a release branch, I'm planning to revert #11289 for now. It can be merged again with a fix to the special case.

cc @sobolevn

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongfalse-positivemypy gave an error on correct code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions