summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-10-03 21:22:42 +0300
committerGitHub <noreply@github.com>2021-10-03 21:22:42 +0300
commit60b9e040c9cf40e69f42c0008e564458aa0379e8 (patch)
treec443c7e9b242382b5b19ce0e5209656bdfa88873 /Objects
parent4f6e0680d0d8545aa151ccd9de56a39bfe9532a2 (diff)
downloadcpython-git-60b9e040c9cf40e69f42c0008e564458aa0379e8.tar.gz
bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/frameobject.c4
-rw-r--r--Objects/genobject.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 00d6888ff2..b743dc72ee 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -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 *
diff --git a/Objects/genobject.c b/Objects/genobject.c
index be9238d9b6..8bd6c8d2c4 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -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);