-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Setting f_trace_opcodes
to True
can lead to f_lineno
being removed in some cases (using breakpoint()
/pdb.set_trace()
)
#127321
Comments
I'm not able to reproduce this on either [1, 2] and breakpoint()
|
Ok took some time to find how to reproduce, but turns out you need at least one extra statement after the breakpoint call. So something like: [1,2] and breakpoint()
a = 1 should work. |
Ah, interesting. Worked for me, thanks! |
@iritkatriel the bytecode of [1, 2] and breakpoint()
a = 2 is
The label |
The There are situations (such as |
Bug report
Bug description:
Since #118579 (introduced in 3.13),
Bdb.set_trace
will callBdb.set_stepinstr
instead ofBdb.set_step
(on L406):cpython/Lib/bdb.py
Lines 389 to 407 in 6d3b520
This ends up setting
f_trace_opcodes
to True on all the frames of the stack.This is fine for most use cases, but for some reason, this removes the
f_lineno
attribute of frames in exotic setups usingbreakpoint()
:I'm using these inline conditions a lot to conditionally add a breakpoint, and not having access to the line number is annoying as many commands (such as
list
) will fail because they expectframe.f_lineno
to not beNone
(and thus crashes and exits the debugger).I'm not familiar with opcodes and how this interacts with frames. It is expected for the
f_lineno
to be lost here?CPython versions tested on:
3.13, 3.14
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: