Skip to content

Commit

Permalink
pythongh-108765: Python.h no longer includes <stddef.h>
Browse files Browse the repository at this point in the history
In practice, only Windows is impacted, since the HAVE_STDDEF_H macro
was only defined on this platform.
  • Loading branch information
vstinner committed Oct 31, 2023
1 parent 2445673 commit dd2ef4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,15 @@ 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. In
practice, it should only impact a minority of users, because 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
----------

Expand Down
3 changes: 0 additions & 3 deletions Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit dd2ef4c

Please sign in to comment.