summaryrefslogtreecommitdiff
path: root/tests/micropython/opt_level_lineno.py
blob: dda9092d868cfc184989b7dfd576e26b45bd50f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import micropython as micropython

# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)

# force bytecode emitter, because native emitter doesn't store line numbers
exec("""
@micropython.bytecode
def f():
    try:
        xyz
    except NameError as er:
        import sys
        sys.print_exception(er)
f()
""")