summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-02-25 14:41:32 (GMT)
committerGitHub <noreply@github.com>2022-02-25 14:41:32 (GMT)
commit4a0c7a1aacd08cead7717479620e62359c828e88 (patch)
treeb063780754c9919fd7f468c8d30f027b3c0c765e /Objects/codeobject.c
parentc579243eb62d3182c84004cd72dcf6ef59100643 (diff)
downloadcpython-4a0c7a1aacd08cead7717479620e62359c828e88.zip
cpython-4a0c7a1aacd08cead7717479620e62359c828e88.tar.gz
cpython-4a0c7a1aacd08cead7717479620e62359c828e88.tar.bz2
bpo-45316: Move private PyCode C API to internal C API (GH-31576)
Rename private functions (no exported), add an underscore prefix: * PyLineTable_InitAddressRange() => _PyLineTable_InitAddressRange() * PyLineTable_NextAddressRange() => _PyLineTable_NextAddressRange() * PyLineTable_PreviousAddressRange() => _PyLineTable_PreviousAddressRange() Move private functions to the internal C API: * _PyCode_Addr2EndLine() * _PyCode_Addr2EndOffset() * _PyCode_Addr2Offset() * _PyCode_InitAddressRange() * _PyCode_InitEndAddressRange( * _PyLineTable_InitAddressRange() * _PyLineTable_NextAddressRange() * _PyLineTable_PreviousAddressRange() No longer export the following internal functions: * _PyCode_GetVarnames() * _PyCode_GetCellvars() * _PyCode_GetFreevars() * _Py_GetSpecializationStats() Add "extern" to pycore_code.h functions to identify them more easiliy (they are still not exported).
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index f166204..f947595 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -676,7 +676,7 @@ _PyCode_Addr2EndOffset(PyCodeObject* co, int addrq)
}
void
-PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range)
+_PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range)
{
range->opaque.lo_next = linetable;
range->opaque.limit = range->opaque.lo_next + length;
@@ -691,7 +691,7 @@ _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds)
{
const char *linetable = PyBytes_AS_STRING(co->co_linetable);
Py_ssize_t length = PyBytes_GET_SIZE(co->co_linetable);
- PyLineTable_InitAddressRange(linetable, length, co->co_firstlineno, bounds);
+ _PyLineTable_InitAddressRange(linetable, length, co->co_firstlineno, bounds);
return bounds->ar_line;
}
@@ -700,7 +700,7 @@ _PyCode_InitEndAddressRange(PyCodeObject* co, PyCodeAddressRange* bounds)
{
char* linetable = PyBytes_AS_STRING(co->co_endlinetable);
Py_ssize_t length = PyBytes_GET_SIZE(co->co_endlinetable);
- PyLineTable_InitAddressRange(linetable, length, co->co_firstlineno, bounds);
+ _PyLineTable_InitAddressRange(linetable, length, co->co_firstlineno, bounds);
return bounds->ar_line;
}
@@ -710,12 +710,12 @@ int
_PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds)
{
while (bounds->ar_end <= lasti) {
- if (!PyLineTable_NextAddressRange(bounds)) {
+ if (!_PyLineTable_NextAddressRange(bounds)) {
return -1;
}
}
while (bounds->ar_start > lasti) {
- if (!PyLineTable_PreviousAddressRange(bounds)) {
+ if (!_PyLineTable_PreviousAddressRange(bounds)) {
return -1;
}
}
@@ -765,7 +765,7 @@ at_end(PyCodeAddressRange *bounds) {
}
int
-PyLineTable_PreviousAddressRange(PyCodeAddressRange *range)
+_PyLineTable_PreviousAddressRange(PyCodeAddressRange *range)
{
if (range->ar_start <= 0) {
return 0;
@@ -779,7 +779,7 @@ PyLineTable_PreviousAddressRange(PyCodeAddressRange *range)
}
int
-PyLineTable_NextAddressRange(PyCodeAddressRange *range)
+_PyLineTable_NextAddressRange(PyCodeAddressRange *range)
{
if (at_end(range)) {
return 0;
@@ -847,7 +847,7 @@ decode_linetable(PyCodeObject *code)
return NULL;
}
_PyCode_InitAddressRange(code, &bounds);
- while (PyLineTable_NextAddressRange(&bounds)) {
+ while (_PyLineTable_NextAddressRange(&bounds)) {
if (bounds.opaque.computed_line != line) {
int bdelta = bounds.ar_start - code_offset;
int ldelta = bounds.opaque.computed_line - line;
@@ -883,7 +883,7 @@ static PyObject *
lineiter_next(lineiterator *li)
{
PyCodeAddressRange *bounds = &li->li_line;
- if (!PyLineTable_NextAddressRange(bounds)) {
+ if (!_PyLineTable_NextAddressRange(bounds)) {
return NULL;
}
PyObject *start = NULL;