From 921eb8ebf6ae9bd359bc03c24bf1f7537bb498ab Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 29 Aug 2023 04:59:49 +0200 Subject: [PATCH] gh-106320: Remove private _PyLong_New() function (#108604) Move the following private API to the internal C API (pycore_long.h): * _PyLong_Copy() * _PyLong_FromDigits() * _PyLong_New() No longer export most of these functions. --- Include/cpython/longintrepr.h | 8 -------- Include/internal/pycore_long.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Include/cpython/longintrepr.h b/Include/cpython/longintrepr.h index 692c69ba76db2f..fb82f83dc50e42 100644 --- a/Include/cpython/longintrepr.h +++ b/Include/cpython/longintrepr.h @@ -89,14 +89,6 @@ struct _longobject { _PyLongValue long_value; }; -PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); - -/* Return a copy of src. */ -PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); - -PyAPI_FUNC(PyLongObject *) -_PyLong_FromDigits(int negative, Py_ssize_t digit_count, digit *digits); - /* Inline some internals for speed. These should be in pycore_long.h * if user code didn't need them inlined. */ diff --git a/Include/internal/pycore_long.h b/Include/internal/pycore_long.h index c9d82711862895..c411ac654387c3 100644 --- a/Include/internal/pycore_long.h +++ b/Include/internal/pycore_long.h @@ -47,6 +47,17 @@ extern "C" { # error "_PY_LONG_DEFAULT_MAX_STR_DIGITS smaller than threshold." #endif +extern PyLongObject* _PyLong_New(Py_ssize_t); + +// Return a copy of src. +extern PyObject* _PyLong_Copy(PyLongObject *src); + +// Export for '_decimal' shared extension +PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits( + int negative, + Py_ssize_t digit_count, + digit *digits); + /* runtime lifecycle */