From 26cf3e5c27725a8856a85d8a1215f8f4d22162d7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 1 Sep 2023 18:38:49 +0200 Subject: [PATCH] gh-108765: Python.h no longer includes Python.h no longer includes these standard header files: , and . They should now be included explicitly if needed. --- Doc/whatsnew/3.13.rst | 5 +++++ Include/pyport.h | 19 ------------------- ...-09-01-18-42-31.gh-issue-108765.IyYNDu.rst | 3 +++ Modules/_multiprocessing/semaphore.c | 4 ++++ Modules/posixmodule.c | 4 ++++ 5 files changed, 16 insertions(+), 19 deletions(-) create mode 100644 Misc/NEWS.d/next/C API/2023-09-01-18-42-31.gh-issue-108765.IyYNDu.rst diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index d35d20ebb252936..2df1218442256bf 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -915,6 +915,11 @@ New Features Porting to Python 3.13 ---------------------- +* ``Python.h`` no longer includes these standard header files: ````, + ```` and ````. They should now be included + explicitly if needed. + (Contributed by Victor Stinner in :gh:`108765`.) + Deprecated ---------- diff --git a/Include/pyport.h b/Include/pyport.h index 115b54fd969287c..eebd344d49d00a6 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -195,25 +195,6 @@ typedef Py_ssize_t Py_ssize_clean_t; #include /* Moved here from the math section, before extern "C" */ -/******************************************** - * WRAPPER FOR and/or * - ********************************************/ - -#ifdef HAVE_SYS_TIME_H -#include -#endif -#include - -/****************************** - * WRAPPER FOR * - ******************************/ - -/* NB caller must include */ - -#ifdef HAVE_SYS_SELECT_H -#include -#endif /* !HAVE_SYS_SELECT_H */ - /******************************* * stat() and fstat() fiddling * *******************************/ diff --git a/Misc/NEWS.d/next/C API/2023-09-01-18-42-31.gh-issue-108765.IyYNDu.rst b/Misc/NEWS.d/next/C API/2023-09-01-18-42-31.gh-issue-108765.IyYNDu.rst new file mode 100644 index 000000000000000..1431ad026a0b25c --- /dev/null +++ b/Misc/NEWS.d/next/C API/2023-09-01-18-42-31.gh-issue-108765.IyYNDu.rst @@ -0,0 +1,3 @@ +``Python.h`` no longer includes these standard header files: ````, +```` and ````. They should now be included +explicitly if needed. Patch by Victor Stinner. diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index d22b8d18e33e428..f8f2afda28d06db 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -9,6 +9,10 @@ #include "multiprocessing.h" +#ifdef HAVE_SYS_TIME_H +# include // gettimeofday() +#endif + #ifdef HAVE_MP_SEMAPHORE enum { RECURSIVE_MUTEX, SEMAPHORE }; diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0436571abc90545..62c99e3bfe24ef6 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -57,6 +57,10 @@ #include // ctermid() #include // system() +#ifdef HAVE_SYS_TIME_H +# include // futimes() +#endif + /* * A number of APIs are available on macOS from a certain macOS version.