Skip to content

Commit 54cb638

Browse files
authored
bpo-44348: Move trace-info to thread-state (GH-26623)
* Move trace-info to thread state. * Correct output for pdb when turning on tracing in middle of line
1 parent e117c02 commit 54cb638

File tree

4 files changed

+73
-85
lines changed

4 files changed

+73
-85
lines changed

Include/cpython/pystate.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
2929
#define PyTrace_OPCODE 7
3030

3131

32+
typedef struct {
33+
PyCodeObject *code; // The code object for the bounds. May be NULL.
34+
PyCodeAddressRange bounds; // Only valid if code != NULL.
35+
} PyTraceInfo;
36+
3237
typedef struct _cframe {
3338
/* This struct will be threaded through the C stack
3439
* allowing fast access to per-thread state that needs
@@ -160,6 +165,7 @@ struct _ts {
160165
uint64_t id;
161166

162167
CFrame root_cframe;
168+
PyTraceInfo trace_info;
163169

164170
_PyStackChunk *datastack_chunk;
165171
PyObject **datastack_top;

Lib/test/test_pdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,8 +1288,8 @@ def test_pdb_issue_20766():
12881288
-> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
12891289
(Pdb) continue
12901290
pdb 1: <built-in function default_int_handler>
1291-
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function()
1292-
-> sess.set_trace(sys._getframe())
1291+
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
1292+
-> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
12931293
(Pdb) continue
12941294
pdb 2: <built-in function default_int_handler>
12951295
"""

0 commit comments

Comments
 (0)