2015-09-01 03:38:09 -04:00
|
|
|
try:
|
2022-10-16 16:58:44 -04:00
|
|
|
Exception().__cause__
|
|
|
|
except AttributeError:
|
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
|
|
|
|
|
|
|
def print_exc_info(e):
|
2022-10-17 10:08:38 -04:00
|
|
|
print("exception", type(e), e.args)
|
2022-10-16 16:58:44 -04:00
|
|
|
print("context", type(e.__context__), e.__suppress_context__)
|
|
|
|
print("cause", type(e.__cause__))
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
1/0
|
|
|
|
except Exception as inner:
|
|
|
|
raise RuntimeError() from inner
|
|
|
|
except Exception as e:
|
|
|
|
print_exc_info(e)
|
|
|
|
print()
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
1/0
|
|
|
|
except Exception as inner:
|
|
|
|
raise RuntimeError() from OSError()
|
|
|
|
except Exception as e:
|
|
|
|
print_exc_info(e)
|
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
1/0
|
|
|
|
except Exception as inner:
|
|
|
|
raise RuntimeError()
|
|
|
|
except Exception as e:
|
|
|
|
print_exc_info(e)
|
|
|
|
print()
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
1/0
|
|
|
|
except Exception as inner:
|
|
|
|
raise RuntimeError() from None
|
|
|
|
except Exception as e:
|
|
|
|
print_exc_info(e)
|
2022-10-17 10:08:38 -04:00
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
raise RuntimeError()
|
|
|
|
except Exception as inner:
|
|
|
|
1/0
|
|
|
|
except Exception as e:
|
|
|
|
print_exc_info(e)
|