Skip to content

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

Merged
miss-islington merged 3 commits into
python:mainfrom
sobolevn:issue-102595
Mar 21, 2023
Merged

gh-102595: Document PyObject_Format c-api function#102596
miss-islington merged 3 commits into
python:mainfrom
sobolevn:issue-102595

Conversation

@sobolevn

@sobolevn sobolevn commented Mar 11, 2023

Copy link
Copy Markdown
Member

@sobolevn

Copy link
Copy Markdown
Member Author

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

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Doc/c-api/object.rst
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
Copy Markdown
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
Copy Markdown
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.

Comment thread Doc/c-api/object.rst Outdated
@JelleZijlstra JelleZijlstra requested a review from encukou March 11, 2023 14:40
@AlexWaygood

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

Get well soon, Petr! :)

Comment thread Doc/c-api/object.rst Outdated
@encukou

encukou commented Mar 21, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

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

@miss-islington

Copy link
Copy Markdown
Contributor

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

@bedevere-bot

Copy link
Copy Markdown

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
Copy Markdown

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