[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 60b9e040c9)
This commit is contained in:
Serhiy Storchaka 2021-10-04 15:01:11 +03:00 committed by GitHub
parent f146ca36f8
commit b5499784ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -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));
}