diff options
| author | Paul Sokolovsky | 2015-04-25 03:17:41 +0300 |
|---|---|---|
| committer | Paul Sokolovsky | 2015-04-25 03:49:23 +0300 |
| commit | 8b85d14b92a65e92862861038c0fe96e6c616c3e (patch) | |
| tree | 237c7a0bad20fb8a31944a6bc7bbc51a97689d3a /tests/misc | |
| parent | cf5b6f6974a1ca7d835803a744d1daae12876dac (diff) | |
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.
Diffstat (limited to 'tests/misc')
| -rw-r--r-- | tests/misc/sys_exc_info.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/misc/sys_exc_info.py b/tests/misc/sys_exc_info.py new file mode 100644 index 000000000..1aad6f189 --- /dev/null +++ b/tests/misc/sys_exc_info.py @@ -0,0 +1,22 @@ +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! |
