Skip to content

Commit

Permalink
gh-106320: Remove private _PyLong_New() function (#108604)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vstinner authored Aug 29, 2023
1 parent 21a7420 commit 921eb8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 0 additions & 8 deletions Include/cpython/longintrepr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
11 changes: 11 additions & 0 deletions Include/internal/pycore_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit 921eb8e

Please sign in to comment.