gh-89488: Add warning about Py_BuildValue("p") needing exact int#135610
Merged
encukou merged 1 commit intopython:mainfrom Jun 23, 2025
Merged
gh-89488: Add warning about Py_BuildValue("p") needing exact int#135610encukou merged 1 commit intopython:mainfrom
Py_BuildValue("p") needing exact int#135610encukou merged 1 commit intopython:mainfrom
Conversation
Comment on lines
+689
to
+693
| 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``. |
Contributor
There was a problem hiding this comment.
Would it make sense to put this inside a .. note:: directive, like the .. note:: This format does not accept bytes-like objects above?
Suggested change
| 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``. | |
| .. note:: | |
| 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``. |
Member
Author
There was a problem hiding this comment.
I wouldn't mind, but, I don't think this needs to be called out so prominently. An extra paragraph is already pretty noticeable.
|
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 23, 2025
…`int` (pythonGH-135610) (cherry picked from commit 6aa0826) Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
GH-135843 is a backport of this pull request to the 3.14 branch. |
AndPuQing
pushed a commit
to AndPuQing/cpython
that referenced
this pull request
Jul 11, 2025
Pranjal095
pushed a commit
to Pranjal095/cpython
that referenced
this pull request
Jul 12, 2025
taegyunkim
pushed a commit
to taegyunkim/cpython
that referenced
this pull request
Aug 4, 2025
Agent-Hellboy
pushed a commit
to Agent-Hellboy/cpython
that referenced
this pull request
Aug 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 Documentation preview 📚: https://cpython-previews--135610.org.readthedocs.build/