]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-89488: Add warning about `Py_BuildValue("p")` needing exact `int` (GH-13561...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 23 Jun 2025 10:41:39 +0000 (12:41 +0200)
committerGitHub <noreply@github.com>
Mon, 23 Jun 2025 10:41:39 +0000 (10:41 +0000)
(cherry picked from commit 6aa0826ed7688e5f40742cdcaf57420b284e194f)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/c-api/arg.rst

index 49dbc8d71cce621291d908200dd8e7e02941e9d5..ab9f9c4539ae9a0b691a5f23a26dbff511a9b5c8 100644 (file)
@@ -686,6 +686,12 @@ Building values
    ``p`` (:class:`bool`) [int]
       Convert a C :c:expr:`int` to a Python :class:`bool` object.
 
+      Be aware that this format requires an ``int`` argument.
+      Unlike most other contexts in C, variadic arguments are not coerced to
+      a suitable type automatically.
+      You can convert another type (for example, a pointer or a float) to a
+      suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``.
+
       .. versionadded:: 3.14
 
    ``c`` (:class:`bytes` of length 1) [char]