Closed
Description
When a uop encounters an error, the line number is set to -1 or to the wrong place.
Repro (on latest main):
a = 1
def func():
global a
i = 20
while i > 0:
del a
i -= 1
if i >= 3:
a = 2
func()
Run this normally and you get this traceback:
Traceback (most recent call last):
File "/Users/guido/cpython/t.py", line 12, in <module>
func()
File "/Users/guido/cpython/t.py", line 7, in func
del a
^
NameError: name 'a' is not defined
But run with -Xuops
, and you get:
Traceback (most recent call last):
File "/Users/guido/cpython/t.py", line 12, in <module>
func()
File "/Users/guido/cpython/t.py", line -1, in func
NameError: name 'a' is not defined