The <Python.h> header file no longer includes <stdio.h> if the
Py_LIMITED_API macro is defined.
``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
----------
# 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
# include <unistd.h>
#endif
#ifdef HAVE_STDDEF_H
- // For size_t
-# include <stddef.h>
+# include <stddef.h> // size_t
#endif
#include <assert.h> // assert()
--- /dev/null
+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.