Files
micropython/tests/misc/sys_exc_info.py
Paul Sokolovsky 8b85d14b92 modsys: Add basic sys.exc_info() implementation.
The implementation is very basic and non-compliant and provided solely for
CPython compatibility. The function itself is bad Python2 heritage, its
usage is discouraged.
2015-04-25 03:49:23 +03:00

23 lines
360 B
Python

import sys
try:
sys.exc_info
except:
print("SKIP")
sys.exit()
def f():
print(sys.exc_info()[0:2])
try:
1/0
except:
print(sys.exc_info()[0:2])
f()
# MicroPython currently doesn't reset sys.exc_info() value
# on exit from "except" block.
#f()
# Recursive except blocks are not handled either - just don't
# use exc_info() at all!