@@ -38,7 +38,7 @@ struct PyCodeObject {
3838 Py_ssize_t * co_cell2arg ; /* Maps cell vars which are arguments. */
3939 PyObject * co_filename ; /* unicode (where it was loaded from) */
4040 PyObject * co_name ; /* unicode (name, for reference) */
41- PyObject * co_lnotab ; /* string (encoding addr<->lineno mapping) See
41+ PyObject * co_linetable ; /* string (encoding addr<->lineno mapping) See
4242 Objects/lnotab_notes.txt for details. */
4343 void * co_zombieframe ; /* for optimization only (see frameobject.c) */
4444 PyObject * co_weakreflist ; /* to support weakrefs to code objects */
@@ -135,16 +135,18 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
135135PyAPI_FUNC (int ) PyCode_Addr2Line (PyCodeObject * , int );
136136
137137/* for internal use only */
138- typedef struct _addr_pair {
139- int ap_lower ;
140- int ap_upper ;
141- } PyAddrPair ;
138+ typedef struct _line_offsets {
139+ int ar_start ;
140+ int ar_end ;
141+ int ar_line ;
142+ int ar_computed_line ;
143+ char * lo_next ;
144+ } PyCodeAddressRange ;
142145
143146/* Update *bounds to describe the first and one-past-the-last instructions in the
144147 same line as lasti. Return the number of that line.
145148*/
146- PyAPI_FUNC (int ) _PyCode_CheckLineNumber (PyCodeObject * co ,
147- int lasti , PyAddrPair * bounds );
149+ PyAPI_FUNC (int ) _PyCode_CheckLineNumber (int lasti , PyCodeAddressRange * bounds );
148150
149151/* Create a comparable key used to compare constants taking in account the
150152 * object type. It is used to make sure types are not coerced (e.g., float and
@@ -163,3 +165,15 @@ PyAPI_FUNC(int) _PyCode_GetExtra(PyObject *code, Py_ssize_t index,
163165 void * * extra );
164166PyAPI_FUNC (int ) _PyCode_SetExtra (PyObject * code , Py_ssize_t index ,
165167 void * extra );
168+
169+ /** API for initializing the line number table. */
170+ int _PyCode_InitAddressRange (PyCodeObject * co , PyCodeAddressRange * bounds );
171+
172+ /** Out of process API for initializing the line number table. */
173+ void PyLineTable_InitAddressRange (char * linetable , int firstlineno , PyCodeAddressRange * range );
174+
175+ /** API for traversing the line number table. */
176+ int PyLineTable_NextAddressRange (PyCodeAddressRange * range );
177+ int PyLineTable_PreviousAddressRange (PyCodeAddressRange * range );
178+
179+
0 commit comments