New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect line numbers in backtrace after removing a trace function #61479
Comments
It seems that using f_trace in the f_lineno getter PyFrame_GetLineNumber(), as In the backtrace printed by tracer.py running with python 3.3, $ python3 /tmp/tracer.py
Traceback (most recent call last):
File "/tmp/tracer.py", line 15, in <module>
foo()
File "/tmp/tracer.py", line 10, in foo
bar()
ZeroDivisionError: division by zero This simple case does not occur with pdb, because pdb takes care of deleting $ python3 /tmp/generator.py
> /tmp/generator.py(16)<module>()
-> foo()
(Pdb) step
--Call--
> /tmp/generator.py(10)foo()
-> def foo():
(Pdb) step
> /tmp/generator.py(11)foo()
-> it = gen()
(Pdb) step
> /tmp/generator.py(12)foo()
-> next(it)
(Pdb) step
--Call--
> /tmp/generator.py(3)gen()
-> def gen():
(Pdb) return
--Return--
> /tmp/generator.py(8)gen()->0
-> yield i
(Pdb) step
> /tmp/generator.py(13)foo()
-> next(it)
(Pdb) continue
Traceback (most recent call last):
File "/tmp/generator.py", line 16, in <module>
foo()
File "/tmp/generator.py", line 13, in foo
next(it)
File "/tmp/generator.py", line 8, in gen
yield i
ZeroDivisionError: division by zero It seems that it could be possible to fix this issue by replacing the test for |
Xavier, could you possibly provide a patch and a test? |
The patch (on the default branch) reverts one of the changes made in r72488 to The other changes made by r72488 in _warnings.c and ceval.c should also The patch updates bdb set_continue() for consistency. The patch adds a test to test_sys_settrace. |
The proposed patch fixes the backtrace line numbers issue, but it does not fix As mentionned in the original message, testing for f->f_trace to implement the I am working on another patch that should fix the issue by changing |
The new patch named traced_frame.patch has been uploaded. Also, now it is not allowed anymore to set the f_lineno attribute of a frame |
The patch is wrong, the frame may not be run by the current PyThreadState. |
This seems to be already fixed. I can't reproduce with 3.13. Close for done. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: