PY3.E0703
Bad exception context
Used when using the syntax raise ... from ..., where the exception context is not an exception, nor None. This message belongs to the exceptions checker.
Noncompliant Code:
Copy
def foo(x, y):
try:
return x / y
except int as e:
raise ZeroDivisionError from e
Compliant Code:
Copy
def foo(x, y):
try:
return x / y
except ZeroDivisionError as e:
raise ValueError from e