Skip to content

Commit 921eb8e

Browse files
authored
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.
1 parent 21a7420 commit 921eb8e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Include/cpython/longintrepr.h

-8
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ struct _longobject {
8989
_PyLongValue long_value;
9090
};
9191

92-
PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);
93-
94-
/* Return a copy of src. */
95-
PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);
96-
97-
PyAPI_FUNC(PyLongObject *)
98-
_PyLong_FromDigits(int negative, Py_ssize_t digit_count, digit *digits);
99-
10092

10193
/* Inline some internals for speed. These should be in pycore_long.h
10294
* if user code didn't need them inlined. */

Include/internal/pycore_long.h

+11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ extern "C" {
4747
# error "_PY_LONG_DEFAULT_MAX_STR_DIGITS smaller than threshold."
4848
#endif
4949

50+
extern PyLongObject* _PyLong_New(Py_ssize_t);
51+
52+
// Return a copy of src.
53+
extern PyObject* _PyLong_Copy(PyLongObject *src);
54+
55+
// Export for '_decimal' shared extension
56+
PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits(
57+
int negative,
58+
Py_ssize_t digit_count,
59+
digit *digits);
60+
5061

5162
/* runtime lifecycle */
5263

0 commit comments

Comments
 (0)