Skip to content

Commit faa5f60

Browse files
authored
gh-108765: Python.h no longer includes <stddef.h> on Windows (#111563)
In practice, only Windows is impacted, because the HAVE_STDDEF_H macro was only defined on Windows.
1 parent c42347d commit faa5f60

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Doc/whatsnew/3.13.rst

+8
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,14 @@ Porting to Python 3.13
11861186
``PyUnicode_AsUTF8AndSize(unicode, NULL)`` can be used instead.
11871187
(Contributed by Victor Stinner in :gh:`111089`.)
11881188

1189+
* On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard
1190+
header file. If needed, it should now be included explicitly. For example, it
1191+
provides ``offsetof()`` function, and ``size_t`` and ``ptrdiff_t`` types.
1192+
Including ``<stddef.h>`` explicitly was already needed by all other
1193+
platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows.
1194+
(Contributed by Victor Stinner in :gh:`108765`.)
1195+
1196+
11891197
Deprecated
11901198
----------
11911199

Include/Python.h

-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
#include <math.h> // HUGE_VAL
2323
#include <stdarg.h> // va_list
2424
#include <wchar.h> // wchar_t
25-
#ifdef HAVE_STDDEF_H
26-
# include <stddef.h> // size_t
27-
#endif
2825
#ifdef HAVE_SYS_TYPES_H
2926
# include <sys/types.h> // ssize_t
3027
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard
2+
header file. If needed, it should now be included explicitly. Patch by
3+
Victor Stinner.

0 commit comments

Comments
 (0)