Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-136823: Update documentation on excluded headers in Python.h#136824

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SZeltaat wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromSZeltaat:update-documentation-on-excluded-headers-in-Python-h

Conversation

SZeltaat
Copy link
Contributor

@SZeltaatSZeltaat commentedJul 19, 2025
edited by github-actionsbot
Loading

This part of the documentation fromhttps://docs.python.org/3/extending/extending.html#a-simple-example is currently outdated:

All user-visible symbols defined by Python.h have a prefix of Py or PY, except those defined in standard header files. For convenience, and since they are used extensively by the Python interpreter, "Python.h" includes a few standard header files: <stdio.h>, <string.h>, <errno.h>, and <stdlib.h>. If the latter header file does not exist on your system, it declares the functions malloc(), free() and realloc() directly.

This PR aligns the documentation with the code and the comments provided by the original author that implemented the changes.


📚 Documentation preview 📚:https://cpython-previews--136824.org.readthedocs.build/

@SZeltaat
Copy link
ContributorAuthor

Hi@AA-Turner, could you please take a look at this PR?
#EuroPython2025

``PY``, except those defined in standard header files.

Note that:file:`Python.h` excludes ``<stdio.h>``, ``<string.h>``, ``<errno.h>``, and ``<stdlib.h>`` as they are not used by
Python anymore. For backward compatibility of existing third party C extensions, they will

Choose a reason for hiding this comment

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

Should we write down since which version they are no longer used, as we did for<ctype.h> and<unistd.h>?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Seems like the right thing to do, but I couldn't find since which version they are no longer used.@vstinner, you seem to have added that comment to the code 4 years ago. Do you happen to know since which version?

@AA-TurnerAA-Turner added sprint needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsJul 19, 2025
Comment on lines 80 to 83
Note that:file:`Python.h` excludes ``<stdio.h>``, ``<string.h>``, ``<errno.h>``, and ``<stdlib.h>`` as they are not used by
Python anymore. For backward compatibility of existing third party C extensions, they will
be included if Py_LIMITED_API is not defined and for limited C API version 3.10 and older.
The ``<ctype.h>`` and ``<unistd.h>`` headers are also not included for limited C API version 3.13 and newer.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Note that:file:`Python.h` excludes ``<stdio.h>``, ``<string.h>``, ``<errno.h>``, and ``<stdlib.h>`` as they are not used by
Python anymore. For backward compatibility of existing third party C extensions, they will
be included ifPy_LIMITED_API is not definedand for limited C API version 3.10 and older.
The ``<ctype.h>`` and ``<unistd.h>`` headers are also not included for limited C API version 3.13 and newer.
For backward compatibility of existing third party C extensions,:file:`Python.h`
includes ``<stdio.h>``, ``<string.h>``, ``<errno.h>``, and ``<stdlib.h>`` iff
:c:macro:`Py_LIMITED_API` is not definedor for limited C API version 3.10 and older.
The ``<ctype.h>`` and ``<unistd.h>`` headers are also not included for limited C API version 3.13 and newer.

ilovelinux reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@skirpichevskirpichevskirpichev left review comments

@ilovelinuxilovelinuxilovelinux left review comments

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

Assignees
No one assigned
Labels
awaiting reviewdocsDocumentation in the Doc dirneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixesskip newssprint
Projects
Status: Todo
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@SZeltaat@skirpichev@ilovelinux@StanFromIreland@AA-Turner

[8]ページ先頭

©2009-2025 Movatter.jp