bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711)

This commit is contained in:
Serhiy Storchaka 2021-10-03 21:22:42 +03:00 committed by GitHub
parent 4f6e0680d0
commit 60b9e040c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View file

@ -240,7 +240,7 @@ _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*2,
return tb_create_raw((PyTracebackObject *)tb_next, frame, frame->f_frame->f_lasti*sizeof(_Py_CODEUNIT),
PyFrame_GetLineNumber(frame));
}
@ -1047,7 +1047,7 @@ dump_frame(int fd, InterpreterFrame *frame)
PUTS(fd, "???");
}
int lineno = PyCode_Addr2Line(code, frame->f_lasti*2);
int lineno = PyCode_Addr2Line(code, frame->f_lasti*sizeof(_Py_CODEUNIT));
PUTS(fd, ", line ");
if (lineno >= 0) {
_Py_DumpDecimal(fd, (size_t)lineno);