mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-43950: Add code.co_positions (PEP 657) (GH-26955)
This PR is part of PEP 657 and augments the compiler to emit ending line numbers as well as starting and ending columns from the AST into compiled code objects. This allows bytecodes to be correlated to the exact source code ranges that generated them. This information is made available through the following public APIs: * The `co_positions` method on code objects. * The C API function `PyCode_Addr2Location`. Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
This commit is contained in:
parent
943e77d42d
commit
98eee94421
15 changed files with 7630 additions and 5185 deletions
|
@ -218,6 +218,8 @@ struct _PyCodeConstructor {
|
|||
PyObject *code;
|
||||
int firstlineno;
|
||||
PyObject *linetable;
|
||||
PyObject *endlinetable;
|
||||
PyObject *columntable;
|
||||
|
||||
/* used by the code */
|
||||
PyObject *consts;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue