From 986e5aa18481edabdf7eff1c00e13b9188dcbe60 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Sat, 28 Sep 2024 01:40:50 +0200 Subject: [PATCH] [3.12] gh-124385: Document and soft-deprecate PyLong_AS_LONG (GH-124386) (cherry picked from commit 425587a110eb214a097c634d4b6d944ac478923e) Co-authored-by: Petr Viktorin --- Doc/c-api/long.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 972d69a5194511..6e1cd1ece850e5 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -135,6 +135,16 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. .. versionchanged:: 3.10 This function will no longer use :meth:`~object.__int__`. + .. c:namespace:: NULL + + .. c:function:: long PyLong_AS_LONG(PyObject *obj) + + A :term:`soft deprecated` alias. + Exactly equivalent to the preferred ``PyLong_AsLong``. In particular, + it can fail with :exc:`OverflowError` or another exception. + + .. deprecated:: 3.14 + The function is soft deprecated. .. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow)