summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-04-29 12:12:51 (GMT)
committerGitHub <noreply@github.com>2021-04-29 12:12:51 (GMT)
commitc76da79b37d2bcbe575cc927ba0a9b7a9ce465db (patch)
treecf5e884131b3f44f038355ff4980cfbb97a6e228 /Include/cpython
parent53dd6c99b39d90935c00bc1558582e494641248e (diff)
downloadcpython-c76da79b37d2bcbe575cc927ba0a9b7a9ce465db.zip
cpython-c76da79b37d2bcbe575cc927ba0a9b7a9ce465db.tar.gz
cpython-c76da79b37d2bcbe575cc927ba0a9b7a9ce465db.tar.bz2
bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)
* Add length parameter to PyLineTable_InitAddressRange and doen't use sentinel values at end of table. Makes the line number table more robust. * Update PyCodeAddressRange to match PEP 626.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/code.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index c3065bb..e810eb4 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -135,12 +135,17 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
/* for internal use only */
+struct _opaque {
+ int computed_line;
+ char *lo_next;
+ char *limit;
+};
+
typedef struct _line_offsets {
int ar_start;
int ar_end;
int ar_line;
- int ar_computed_line;
- char *lo_next;
+ struct _opaque opaque;
} PyCodeAddressRange;
/* Update *bounds to describe the first and one-past-the-last instructions in the
@@ -170,7 +175,7 @@ PyAPI_FUNC(int) _PyCode_SetExtra(PyObject *code, Py_ssize_t index,
int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
/** Out of process API for initializing the line number table. */
-void PyLineTable_InitAddressRange(char *linetable, int firstlineno, PyCodeAddressRange *range);
+void PyLineTable_InitAddressRange(char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range);
/** API for traversing the line number table. */
int PyLineTable_NextAddressRange(PyCodeAddressRange *range);