3fb1bb131f
"Raise SomeException() from None" is a common Python idiom to suppress chained exceptions and thus shouldn't trigger a warning on a version of Python that doesn't support them in the first place.
16 lines
361 B
Python
16 lines
361 B
Python
# Exception chaining is not supported, but check that basic
|
|
# exception works as expected.
|
|
|
|
try:
|
|
raise Exception from None
|
|
except Exception:
|
|
print("Caught Exception")
|
|
|
|
try:
|
|
try:
|
|
raise ValueError("Value")
|
|
except Exception as exc:
|
|
raise RuntimeError("Runtime") from exc
|
|
except Exception as ex2:
|
|
print("Caught Exception:", ex2)
|