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

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 7 Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,13 @@ Porting to Python 3.11
``exit()`` and ``abort()``.
(Contributed by Victor Stinner in :issue:`45434`.)

* The ``<Python.h>`` header file no longer includes ``<stdio.h>`` if the
``Py_LIMITED_API`` macro is defined. Functions expecting ``FILE*`` are
excluded from the limited C API (:pep:`384`). C extensions using
``<stdio.h>`` must now include it explicitly. The system ``<stdio.h>``
header provides functions like ``printf()`` and ``fopen()``.
(Contributed by Victor Stinner in :issue:`45434`.)

Deprecated
----------

Expand Down
11 changes: 4 additions & 7 deletions 11 Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,18 @@
# define _SGI_MP_SOURCE
#endif

#include <stdio.h> // NULL, FILE*
#ifndef NULL
# error "Python.h requires that stdio.h define NULL."
#endif

#include <string.h> // memcpy()
#ifndef Py_LIMITED_API
# include <stdio.h> // FILE*
#endif
#ifdef HAVE_ERRNO_H
# include <errno.h> // errno
#endif
#ifndef MS_WINDOWS
# include <unistd.h>
#endif
#ifdef HAVE_STDDEF_H
// For size_t
# include <stddef.h>
# include <stddef.h> // size_t
#endif

#include <assert.h> // assert()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The ``<Python.h>`` header file no longer includes ``<stdio.h>`` if the
``Py_LIMITED_API`` macro is defined. Functions expecting ``FILE*`` are excluded
from the limited C API (:pep:`384`). C extensions using ``<stdio.h>`` must now
include it explicitly.
Patch by Victor Stinner.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.