Skip to content

Outdated documentation for including <errno.h>, <stdio.h>, <stdlib.h> and <string.h> in Python.h #136823

@SZeltaat

Description

@SZeltaat

Working on this at EuroPython2025:

Python documentation on extending states the following:

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.

But this does not align with the current state of Python.h. <errno.h>, <stdio.h>, <stdlib.h> and <string.h> headers are no longer used by Python. They are not included by limited C API version 3.11 and newer.

The <ctype.h> and <unistd.h> headers are also not included by limited C API version 3.13 and newer.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirsprint

    Projects

    Status

    Todo

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions