bpo-45434: Limited Python.h no longer includes stdio.h (GH-28960)
The <Python.h> header file no longer includes <stdio.h> if the Py_LIMITED_API macro is defined.
This commit is contained in:
parent
af1083e975
commit
284994762d
@ -565,6 +565,13 @@ Porting to Python 3.11
|
|||||||
``exit()`` and ``abort()``.
|
``exit()`` and ``abort()``.
|
||||||
(Contributed by Victor Stinner in :issue:`45434`.)
|
(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
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -16,12 +16,10 @@
|
|||||||
# define _SGI_MP_SOURCE
|
# define _SGI_MP_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h> // NULL, FILE*
|
|
||||||
#ifndef NULL
|
|
||||||
# error "Python.h requires that stdio.h define NULL."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h> // memcpy()
|
#include <string.h> // memcpy()
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
# include <stdio.h> // FILE*
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ERRNO_H
|
#ifdef HAVE_ERRNO_H
|
||||||
# include <errno.h> // errno
|
# include <errno.h> // errno
|
||||||
#endif
|
#endif
|
||||||
@ -29,8 +27,7 @@
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STDDEF_H
|
#ifdef HAVE_STDDEF_H
|
||||||
// For size_t
|
# include <stddef.h> // size_t
|
||||||
# include <stddef.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h> // assert()
|
#include <assert.h> // assert()
|
||||||
|
@ -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.
|
Loading…
x
Reference in New Issue
Block a user