summaryrefslogtreecommitdiffstatshomepage
path: root/tests/misc/print_exception.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc/print_exception.py')
-rw-r--r--tests/misc/print_exception.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/misc/print_exception.py b/tests/misc/print_exception.py
index 9baac713ee..b833a79816 100644
--- a/tests/misc/print_exception.py
+++ b/tests/misc/print_exception.py
@@ -1,8 +1,13 @@
+import sys
try:
- import uio as io
+ try:
+ import uio as io
+ except ImportError:
+ import io
except ImportError:
- import io
-import sys
+ print("SKIP")
+ sys.exit()
+
if hasattr(sys, 'print_exception'):
print_exception = sys.print_exception
else:
@@ -41,3 +46,13 @@ try:
except Exception as e:
print('caught')
print_exc(e)
+
+# Here we have a function with lots of bytecode generated for a single source-line, and
+# there is an error right at the end of the bytecode. It should report the correct line.
+def f():
+ f([1, 2], [1, 2], [1, 2], {1:1, 1:1, 1:1, 1:1, 1:1, 1:1, 1:X})
+ return 1
+try:
+ f()
+except Exception as e:
+ print_exc(e)