From c0c25b1daffce939b8e0885418d21d1f3053899e Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 23 Sep 2024 15:05:00 -0700 Subject: [PATCH 1/3] Document and soft-deprecate PyLong_AS_LONG --- Doc/c-api/long.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 098a55c50e219a..bfd215c592f7e3 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -159,7 +159,6 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. .. versionadded:: 3.13 -.. XXX alias PyLong_AS_LONG (for now) .. c:function:: long PyLong_AsLong(PyObject *obj) .. index:: @@ -181,6 +180,13 @@ 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. .. c:function:: int PyLong_AsInt(PyObject *obj) From b800c15d9013302f4b3e33cbe800e607c562ab12 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 25 Sep 2024 19:30:35 +0200 Subject: [PATCH 2/3] Apply suggestion from code review --- Doc/c-api/long.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index bfd215c592f7e3..eb960579b0fbb8 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -188,6 +188,9 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. 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:: int PyLong_AsInt(PyObject *obj) Similar to :c:func:`PyLong_AsLong`, but store the result in a C From 76f65dd15ea1933a21a3f59e717459d264b556ae Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Sat, 28 Sep 2024 01:20:50 +0200 Subject: [PATCH 3/3] Apply suggestion from linter --- Doc/c-api/long.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index eb960579b0fbb8..63b368410e8e28 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -189,7 +189,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. it can fail with :exc:`OverflowError` or another exception. .. deprecated:: 3.14 - The function is soft deprecated. + The function is soft deprecated. .. c:function:: int PyLong_AsInt(PyObject *obj)