-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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-107298: Fix C API Buffer documentation #108011
Conversation
Fix some of the Sphinx warnings reported in https://github.com/python/cpython/pull/108010/files PR (PR unrelated to documentation). |
@@ -444,7 +448,7 @@ Buffer-related functions | |||
|
|||
Send a request to *exporter* to fill in *view* as specified by *flags*. | |||
If the exporter cannot provide a buffer of the exact type, it MUST raise | |||
:c:data:`PyExc_BufferError`, set ``view->obj`` to ``NULL`` and | |||
:exc:`BufferError`, set ``view->obj`` to ``NULL`` and |
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.
There is yet one reference in typeobj.rst.
@@ -163,13 +163,6 @@ a buffer, see :c:func:`PyObject_GetBuffer`. | |||
and :c:member:`~Py_buffer.suboffsets` MUST be ``NULL``. | |||
The maximum number of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`. | |||
|
|||
.. :c:macro:: PyBUF_MAX_NDIM |
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.
You can just add
.. c:namespace:: NULL
here, and restore the namespace after the description to fix reference issues.
I already used it for some macros declared not at the top level.
https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#namespacing
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 saw your "namespace: NULL" trick of your other PRs, but here Py_buffer members are defined before and after this macro which is not part of Py_buffer structure. In terms of Sphinx, it's confusing. I prefer to document it somewhere else.
Thanks for the review @serhiy-storchaka. |
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, @vstinner, I could not cleanly backport this to |
GH-108041 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit c2941cb) Co-authored-by: Victor Stinner <[email protected]>
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry @vstinner, I had trouble checking out the |
Conflict in 3.12 but not in 3.11? |
…). (cherry picked from commit c2941cb) Co-authored-by: Victor Stinner <[email protected]>
GH-108048 is a backport of this pull request to the 3.12 branch. |
(cherry picked from commit c2941cb) Co-authored-by: Victor Stinner <[email protected]>
📚 Documentation preview 📚: https://cpython-previews--108011.org.readthedocs.build/