summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-04-07 19:31:01 (GMT)
committerGitHub <noreply@github.com>2022-04-07 19:31:01 (GMT)
commitef6a482b0285870c45f39c9b17ed827362b334ae (patch)
treea32a27a4d209b974d9f4d92e7e997dc3ff771409 /Python/traceback.c
parent87eec70d97b250f820325b4f1b4f781b443b5180 (diff)
downloadcpython-ef6a482b0285870c45f39c9b17ed827362b334ae.zip
cpython-ef6a482b0285870c45f39c9b17ed827362b334ae.tar.gz
cpython-ef6a482b0285870c45f39c9b17ed827362b334ae.tar.bz2
bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208)
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 488c1b1..3ec0618 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -238,8 +238,8 @@ _PyTraceBack_FromFrame(PyObject *tb_next, PyFrameObject *frame)
{
assert(tb_next == NULL || PyTraceBack_Check(tb_next));
assert(frame != NULL);
-
- return tb_create_raw((PyTracebackObject *)tb_next, frame, frame->f_frame->f_lasti*sizeof(_Py_CODEUNIT),
+ int addr = _PyInterpreterFrame_LASTI(frame->f_frame) * sizeof(_Py_CODEUNIT);
+ return tb_create_raw((PyTracebackObject *)tb_next, frame, addr,
PyFrame_GetLineNumber(frame));
}
@@ -1180,7 +1180,7 @@ dump_frame(int fd, _PyInterpreterFrame *frame)
PUTS(fd, "???");
}
- int lineno = PyCode_Addr2Line(code, frame->f_lasti*sizeof(_Py_CODEUNIT));
+ int lineno = _PyInterpreterFrame_GetLine(frame);
PUTS(fd, ", line ");
if (lineno >= 0) {
_Py_DumpDecimal(fd, (size_t)lineno);