mirror of
https://github.com/python/cpython.git
synced 2025-10-28 01:00:34 +00:00
bpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally. (GH-25069)
* Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps. * Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
This commit is contained in:
parent
2ac0515027
commit
fcb55c0037
14 changed files with 4568 additions and 4569 deletions
|
|
@ -233,7 +233,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_lasti,
|
||||
return tb_create_raw((PyTracebackObject *)tb_next, frame, frame->f_lasti*2,
|
||||
PyFrame_GetLineNumber(frame));
|
||||
}
|
||||
|
||||
|
|
@ -763,8 +763,7 @@ dump_frame(int fd, PyFrameObject *frame)
|
|||
PUTS(fd, "???");
|
||||
}
|
||||
|
||||
/* PyFrame_GetLineNumber() was introduced in Python 2.7.0 and 3.2.0 */
|
||||
int lineno = PyCode_Addr2Line(code, frame->f_lasti);
|
||||
int lineno = PyFrame_GetLineNumber(frame);
|
||||
PUTS(fd, ", line ");
|
||||
if (lineno >= 0) {
|
||||
_Py_DumpDecimal(fd, (size_t)lineno);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue