Skip to content

gh-141004: Document the remaining parts of the public C API - #159892

Open
ZeroIntensity wants to merge 13 commits into
python:mainfrom
ZeroIntensity:docs/c-api/the-remaining-stuff
Open

ZeroIntensity wants to merge 13 commits into
python:mainfrom
ZeroIntensity:docs/c-api/the-remaining-stuff

Conversation

@ZeroIntensity

@ZeroIntensity ZeroIntensity commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Almost there!

@read-the-docs-community

read-the-docs-community Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35283763 | 📁 Comparing 284f5f4 against main (f5d989e)

  🔍 Preview build  

25 files changed · + 1 added · ± 24 modified

+ Added

± Modified

Comment thread Doc/conf.py Outdated

@encukou encukou 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 have a bunch of suggestions for these.

Comment thread Doc/c-api/code.rst Outdated
Comment thread Doc/c-api/conversion.rst
Comment thread Doc/c-api/file.rst Outdated
Comment on lines +164 to +167
String literal ``"b"``, which can be appended to a C standard I/O mode
string, such as ``"r" PY_STDIOTEXTMODE``, to open a file in binary mode.
This prevents the C library from translating newlines, so that Python can
perform its own newline translation.

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.

Users don't need this in standard C.

Suggested change
String literal ``"b"``, which can be appended to a C standard I/O mode
string, such as ``"r" PY_STDIOTEXTMODE``, to open a file in binary mode.
This prevents the C library from translating newlines, so that Python can
perform its own newline translation.
The string literal ``"b"``, used to open files in binary mode.
Exposed for backwards compatibility only.
.. soft-deprecated:: next

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.

One more thing: there's a "Soft-deprecated API" section just below this, move it there?

Comment thread Doc/c-api/hash.rst Outdated
Comment thread Doc/c-api/intro.rst Outdated
Comment thread Doc/c-api/pyexpat.rst Outdated
Comment thread Doc/c-api/pyexpat.rst Outdated
Comment thread Doc/c-api/pyexpat.rst Outdated
Comment thread Doc/c-api/pyexpat.rst Outdated
Comment thread Doc/c-api/pyexpat.rst Outdated
Comment thread Doc/c-api/veryhigh.rst Outdated
Comment thread Doc/c-api/veryhigh.rst Outdated
Comment thread Doc/c-api/veryhigh.rst Outdated
Comment thread Doc/c-api/weakref.rst Outdated
Comment thread Doc/c-api/pyexpat.rst Outdated
@ZeroIntensity
ZeroIntensity requested a review from encukou October 20, 2026 23:32

@encukou encukou 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 don't think you need to check the Expat version.

Comment thread Doc/c-api/pyexpat.rst
Comment on lines +22 to +28
its ``magic`` member compares equal to this string using ``strcmp()``,
its ``size`` member is at least :c:expr:`sizeof(struct PyExpat_CAPI)`, and its
:c:member:`PyExpat_CAPI.MAJOR_VERSION`, :c:member:`PyExpat_CAPI.MINOR_VERSION`,
and :c:member:`PyExpat_CAPI.MICRO_VERSION` members equal the
``XML_MAJOR_VERSION``, ``XML_MINOR_VERSION``, and ``XML_MICRO_VERSION``
macros, respectively, from the :file:`expat.h` header used to build the
extension.

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.

Suggested change
its ``magic`` member compares equal to this string using ``strcmp()``,
its ``size`` member is at least :c:expr:`sizeof(struct PyExpat_CAPI)`, and its
:c:member:`PyExpat_CAPI.MAJOR_VERSION`, :c:member:`PyExpat_CAPI.MINOR_VERSION`,
and :c:member:`PyExpat_CAPI.MICRO_VERSION` members equal the
``XML_MAJOR_VERSION``, ``XML_MINOR_VERSION``, and ``XML_MICRO_VERSION``
macros, respectively, from the :file:`expat.h` header used to build the
extension.
its ``magic`` member compares equal to this string using ``strcmp()``
and its ``size`` member is at least :c:expr:`sizeof(struct PyExpat_CAPI)`.

Comment thread Doc/c-api/pyexpat.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo
Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants