]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-141004: Document `PyLong_FromPid` and `PyLong_AsPid` (GH-141028) (GH-141143)
authorPeter Bierma <zintensitydev@gmail.com>
Thu, 6 Nov 2025 14:10:24 +0000 (09:10 -0500)
committerGitHub <noreply@github.com>
Thu, 6 Nov 2025 14:10:24 +0000 (14:10 +0000)
* gh-141004: Document `PyLong_FromPid` and `PyLong_AsPid` (GH-141028)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit bcc524f82d8548707046ce90f5bc56f60018767a)

Doc/c-api/long.rst

index 7dfb26d0ad5ea93c78664c0f6c693ce339a70ba2..2d70f46f3e4897869805e325a8e7232a0252cccb 100644 (file)
@@ -141,6 +141,17 @@ distinguished from a number.  Use :c:func:`PyErr_Occurred` to disambiguate.
    .. versionadded:: 3.13
 
 
+.. c:macro:: PyLong_FromPid(pid)
+
+   Macro for creating a Python integer from a process identifier.
+
+   This can be defined as an alias to :c:func:`PyLong_FromLong` or
+   :c:func:`PyLong_FromLongLong`, depending on the size of the system's
+   PID type.
+
+   .. versionadded:: 3.2
+
+
 .. c:function:: long PyLong_AsLong(PyObject *obj)
 
    .. index::
@@ -369,6 +380,17 @@ distinguished from a number.  Use :c:func:`PyErr_Occurred` to disambiguate.
    Returns ``NULL`` on error.  Use :c:func:`PyErr_Occurred` to disambiguate.
 
 
+.. c:macro:: PyLong_AsPid(pid)
+
+   Macro for converting a Python integer into a process identifier.
+
+   This can be defined as an alias to :c:func:`PyLong_AsLong`,
+   :c:func:`PyLong_FromLongLong`, or :c:func:`PyLong_AsInt`, depending on the
+   size of the system's PID type.
+
+   .. versionadded:: 3.2
+
+
 .. c:function:: Py_ssize_t PyLong_AsNativeBytes(PyObject *pylong, void* buffer, Py_ssize_t n_bytes, int flags)
 
    Copy the Python integer value *pylong* to a native *buffer* of size