[3.10] bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711). (GH-28718)
(cherry picked from commit 60b9e040c9cf40e69f42c0008e564458aa0379e8)
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index aa97301..8974d37 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -46,7 +46,7 @@ PyFrame_GetLineNumber(PyFrameObject *f)
return f->f_lineno;
}
else {
- return PyCode_Addr2Line(f->f_code, f->f_lasti*2);
+ return PyCode_Addr2Line(f->f_code, f->f_lasti*sizeof(_Py_CODEUNIT));
}
}
@@ -68,7 +68,7 @@ frame_getlasti(PyFrameObject *f, void *closure)
if (f->f_lasti < 0) {
return PyLong_FromLong(-1);
}
- return PyLong_FromLong(f->f_lasti*2);
+ return PyLong_FromLong(f->f_lasti*sizeof(_Py_CODEUNIT));
}