Skip to content

gh-102595: Document PyObject_Format c-api function #102596

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

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Mar 11, 2023

@sobolevn
Copy link
Member Author

@JelleZijlstra @AlexWaygood I don't know who else might take a look, github does not suggest anybody :)
Would you, please?

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can review the text, but going to request review from @encukou to confirm whether this should be documented, as I am not an expert on the C API.

@@ -179,6 +179,13 @@ Object Protocol
If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool`
will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`.

.. c:function:: PyObject* PyObject_Format(PyObject *obj, PyObject *format_spec)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that we're inconsistent in putting the space before or after the *, but the next two functions do the same thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relevant style guide would be PEP 7, but it says nothing about this issue. All the examples use PyObject *x, though.

@JelleZijlstra JelleZijlstra requested a review from encukou March 11, 2023 14:40
@AlexWaygood
Copy link
Member

I'm also not an expert on the C API, and also would have suggested @encukou as a reviewer for this one (though his GitHub status says he's ill right now 🙁). With @JelleZijlstra's suggestions, the wording looks good, though!

@JelleZijlstra
Copy link
Member

(though his GitHub status says he's ill right now 🙁).

I didn't notice that, sorry for pinging you Petr!

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@sobolevn
Copy link
Member Author

Get well soon, Petr! :)

@encukou
Copy link
Member

encukou commented Mar 21, 2023

Thanks for the wishes, and for the docs!
IMO, this definitely should be documented.

@miss-islington miss-islington merged commit 910a64e into python:main Mar 21, 2023
@encukou encukou added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Mar 21, 2023
@miss-islington
Copy link
Contributor

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-102878 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Mar 21, 2023
@bedevere-bot
Copy link

GH-102879 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Mar 21, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 21, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 21, 2023
miss-islington added a commit that referenced this pull request Mar 22, 2023
… (GH-102879)

(cherry picked from commit 910a64e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Def: https://github.com/python/cpython/blame/5ffdaf748d98da6065158534720f1996a45a0072/Include/abstract.hGH-L389

Automerge-Triggered-By: GH:encukou
miss-islington added a commit that referenced this pull request Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants