diff --git a/Doc/deprecations/c-api-pending-removal-in-future.rst b/Doc/deprecations/c-api-pending-removal-in-future.rst index 8fc1c80c35d092..0ed1d607174525 100644 --- a/Doc/deprecations/c-api-pending-removal-in-future.rst +++ b/Doc/deprecations/c-api-pending-removal-in-future.rst @@ -35,6 +35,8 @@ although there is currently no date scheduled for their removal. * :c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` instead. * :c:member:`!PyDictObject.ma_version_tag` member. +* :c:func::c:func:`!_PyLong_FromDigits` + Use instead :c:struct:`PyLongWriter` API. * Thread Local Storage (TLS) API: * :c:func:`PyThread_create_key`: diff --git a/Include/cpython/longintrepr.h b/Include/cpython/longintrepr.h index 357477b60d9a5a..cdb99509b6b50b 100644 --- a/Include/cpython/longintrepr.h +++ b/Include/cpython/longintrepr.h @@ -105,7 +105,7 @@ 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( +Py_DEPRECATED(3.14) PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits( int negative, Py_ssize_t digit_count, digit *digits); diff --git a/Misc/NEWS.d/next/C_API/2024-12-14-10-14-27.gh-issue-127937.-tT1KP.rst b/Misc/NEWS.d/next/C_API/2024-12-14-10-14-27.gh-issue-127937.-tT1KP.rst new file mode 100644 index 00000000000000..ad74d45f17d250 --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2024-12-14-10-14-27.gh-issue-127937.-tT1KP.rst @@ -0,0 +1,2 @@ +Deprecate the :c:func:`!_PyLong_FromDigits`, use instead +:c:struct:`PyLongWriter` API. Patch by Sergey B Kirpichev.