Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-141004: Document missing PyCFunction* and PyCMethod* APIs#141253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-141004: Document missing PyCFunction* and PyCMethod* APIs #141253
Uh oh!
There was an error while loading. Please reload this page.
Conversation
ZeroIntensity commented Nov 8, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
sharktide left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested some updates so the tone is consistent (eg. We use trailing "s" chars like "returns" but we use "Get" instead of "Gets") so we should keep the same style for consistency and to improve reading flow
I also surrounded true and false with backticks
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
sharktide left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case it looks fine to me / LGTM
Doc/c-api/structures.rst Outdated
| available as :class:`types.BuiltinFunctionType` in the Python layer. | ||
| .. c:function::intPyCFunction_Check(PyObject *f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep a consistent name for the parameter. For _Check functions, I would prefer having op everywhere.
Uh oh!
There was an error while loading. Please reload this page.
Doc/c-api/structures.rst Outdated
| to the first argument of a :c:type:`PyCFunction`. In modules, this is the | ||
| module object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"In modules, this is the module object" is unclear. I would either say "For modules"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what you think of the new wording.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Doc/c-api/structures.rst Outdated
| If *func* is not a C function object, this fails with a | ||
| :class:`SystemError`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a regular exception right? so no need to mention it. What I wanted to know is whether passing func == NULL produced a SIGSEGV or a Python exception. Since passing NULL is "allowed" (but raises an exception) it's fine to remove the mention to SystemError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My advice is: check other Check functions to see how we formulate this. I don't want to be too pedantic but I want to be consistent in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a regular exception right? so no need to mention it. What I wanted to know is whether passing func == NULL produced a SIGSEGV or a Python exception. Since passing NULL is "allowed" (but raises an exception) it's fine to remove the mention to SystemError.
Ah, ok. NULL will result in a SIGSEGV, but a non-function will result in a SystemError. I updated the text to hopefully clarify that better.
Uh oh!
There was an error while loading. Please reload this page.
Doc/c-api/structures.rst Outdated
picnixzNov 16, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have 3 blank lines here. I'll let you edit this locally
be699d6 into python:mainUh oh!
There was an error while loading. Please reload this page.
Thanks @ZeroIntensity for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
pythonGH-141253) (cherry picked from commit be699d6) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
GH-141637 is a backport of this pull request to the 3.14 branch. |
pythonGH-141253) (cherry picked from commit be699d6) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
GH-141638 is a backport of this pull request to the 3.13 branch. |
…Is (GH-141253) (GH-141637) gh-141004: Document missing `PyCFunction*` and `PyCMethod*` APIs (GH-141253) (cherry picked from commit be699d6) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
…Is (GH-141253) (GH-141638) gh-141004: Document missing `PyCFunction*` and `PyCMethod*` APIs (GH-141253) (cherry picked from commit be699d6) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
pythonGH-141253) Co-authored-by: Bénédikt Tran <[email protected]>
📚 Documentation preview 📚: https://cpython-previews--141253.org.readthedocs.build/en/141253/c-api/structures.html#implementing-functions-and-methods