]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-108765: Python.h no longer includes <stddef.h> on Windows (#111563)
authorVictor Stinner <vstinner@python.org>
Tue, 31 Oct 2023 20:53:57 +0000 (21:53 +0100)
committerGitHub <noreply@github.com>
Tue, 31 Oct 2023 20:53:57 +0000 (21:53 +0100)
In practice, only Windows is impacted, because the HAVE_STDDEF_H
macro was only defined on Windows.

Doc/whatsnew/3.13.rst
Include/Python.h
Misc/NEWS.d/next/C API/2023-10-31-18-22-03.gh-issue-108765._beYv8.rst [new file with mode: 0644]

index 3a2df4fc8a3de5515f40ee0e69cf14c2dcb345bb..197790234a1582f5ef4fe536cfaed0323dd99a6d 100644 (file)
@@ -1186,6 +1186,14 @@ Porting to Python 3.13
   ``PyUnicode_AsUTF8AndSize(unicode, NULL)`` can be used instead.
   (Contributed by Victor Stinner in :gh:`111089`.)
 
+* On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard
+  header file. If needed, it should now be included explicitly. For example, it
+  provides ``offsetof()`` function, and ``size_t`` and ``ptrdiff_t`` types.
+  Including ``<stddef.h>`` explicitly was already needed by all other
+  platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows.
+  (Contributed by Victor Stinner in :gh:`108765`.)
+
+
 Deprecated
 ----------
 
index 7312cc87d5cc33b25385a6982f63dca5c7c88f83..a1f26afbb12256ddc67802e215ee2856c402fba3 100644 (file)
@@ -22,9 +22,6 @@
 #include <math.h>                 // HUGE_VAL
 #include <stdarg.h>               // va_list
 #include <wchar.h>                // wchar_t
-#ifdef HAVE_STDDEF_H
-#  include <stddef.h>             // size_t
-#endif
 #ifdef HAVE_SYS_TYPES_H
 #  include <sys/types.h>          // ssize_t
 #endif
diff --git a/Misc/NEWS.d/next/C API/2023-10-31-18-22-03.gh-issue-108765._beYv8.rst b/Misc/NEWS.d/next/C API/2023-10-31-18-22-03.gh-issue-108765._beYv8.rst
new file mode 100644 (file)
index 0000000..14af79e
--- /dev/null
@@ -0,0 +1,3 @@
+On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard
+header file. If needed, it should now be included explicitly. Patch by
+Victor Stinner.