mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711)
This commit is contained in:
parent
4f6e0680d0
commit
60b9e040c9
5 changed files with 15 additions and 15 deletions
|
|
@ -45,7 +45,7 @@ PyFrame_GetLineNumber(PyFrameObject *f)
|
|||
return f->f_lineno;
|
||||
}
|
||||
else {
|
||||
return PyCode_Addr2Line(f->f_frame->f_code, f->f_frame->f_lasti*2);
|
||||
return PyCode_Addr2Line(f->f_frame->f_code, f->f_frame->f_lasti*sizeof(_Py_CODEUNIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ frame_getlasti(PyFrameObject *f, void *closure)
|
|||
if (f->f_frame->f_lasti < 0) {
|
||||
return PyLong_FromLong(-1);
|
||||
}
|
||||
return PyLong_FromLong(f->f_frame->f_lasti*2);
|
||||
return PyLong_FromLong(f->f_frame->f_lasti*sizeof(_Py_CODEUNIT));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
|||
|
|
@ -1284,7 +1284,7 @@ compute_cr_origin(int origin_depth)
|
|||
PyCodeObject *code = frame->f_code;
|
||||
PyObject *frameinfo = Py_BuildValue("OiO",
|
||||
code->co_filename,
|
||||
PyCode_Addr2Line(frame->f_code, frame->f_lasti*2),
|
||||
PyCode_Addr2Line(frame->f_code, frame->f_lasti*sizeof(_Py_CODEUNIT)),
|
||||
code->co_name);
|
||||
if (!frameinfo) {
|
||||
Py_DECREF(cr_origin);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue