https://github.com/python/cpython/commit/f0a330e5fbaebf24a1a1b9bcebf5e9be7084f241
commit: f0a330e5fbaebf24a1a1b9bcebf5e9be7084f241
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: encukou <encu...@gmail.com>
date: 2025-06-23T10:41:39Z
summary:

[3.14] gh-89488: Add warning about `Py_BuildValue("p")` needing exact `int` 
(GH-135610) (GH-135843)

(cherry picked from commit 6aa0826ed7688e5f40742cdcaf57420b284e194f)

Co-authored-by: Petr Viktorin <encu...@gmail.com>

files:
M Doc/c-api/arg.rst

diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index 49dbc8d71cce62..ab9f9c4539ae9a 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -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]

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to