File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed
Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -565,6 +565,13 @@ Porting to Python 3.11
565565 ``exit() `` and ``abort() ``.
566566 (Contributed by Victor Stinner in :issue: `45434 `.)
567567
568+ * The ``<Python.h> `` header file no longer includes ``<stdio.h> `` if the
569+ ``Py_LIMITED_API `` macro is defined. Functions expecting ``FILE* `` are
570+ excluded from the limited C API (:pep: `384 `). C extensions using
571+ ``<stdio.h> `` must now include it explicitly. The system ``<stdio.h> ``
572+ header provides functions like ``printf() `` and ``fopen() ``.
573+ (Contributed by Victor Stinner in :issue: `45434 `.)
574+
568575Deprecated
569576----------
570577
Original file line number Diff line number Diff line change 1616# define _SGI_MP_SOURCE
1717#endif
1818
19- #include <stdio.h> // NULL, FILE*
20- #ifndef NULL
21- # error "Python.h requires that stdio.h define NULL."
22- #endif
23-
2419#include <string.h> // memcpy()
20+ #ifndef Py_LIMITED_API
21+ # include <stdio.h> // FILE*
22+ #endif
2523#ifdef HAVE_ERRNO_H
2624# include <errno.h> // errno
2725#endif
2826#ifndef MS_WINDOWS
2927# include <unistd.h>
3028#endif
3129#ifdef HAVE_STDDEF_H
32- // For size_t
33- # include <stddef.h>
30+ # include <stddef.h> // size_t
3431#endif
3532
3633#include <assert.h> // assert()
Original file line number Diff line number Diff line change 1+ The ``<Python.h> `` header file no longer includes ``<stdio.h> `` if the
2+ ``Py_LIMITED_API `` macro is defined. Functions expecting ``FILE* `` are excluded
3+ from the limited C API (:pep: `384 `). C extensions using ``<stdio.h> `` must now
4+ include it explicitly.
5+ Patch by Victor Stinner.
You can’t perform that action at this time.
0 commit comments