bpo-45434: Only exclude <stdlib.h> in Python 3.11 limited C API by vstinner · Pull Request #29027 · python/cpython
The Python 3.11 limited C API no longer includes stdlib.h, stdio.h,
string.h and errno.h.
- Exclude Py_MEMCPY() from Python 3.11 limited C API.
- xxlimited C extension is now built with Python 3.11 limited C API.
The Python 3.11 limited C API no longer includes stdlib.h, stdio.h, string.h and errno.h. * Exclude Py_MEMCPY() from Python 3.11 limited C API. * xxlimited C extension is now built with Python 3.11 limited C API.
I not sure if doing this is worth the effort, this makes the headers more complicated and only affects the few extensions that target the stable ABI and want to use API's introduced in 3.11.
I not sure if doing this is worth the effort, this makes the headers more complicated and only affects the few extensions that target the stable ABI and want to use API's introduced in 3.11.
I think it's worth doing. In the long run it's going to make Python.h lean and mean.
@tiran: I addresssed your review.
I not sure if doing this is worth the effort, this makes the headers more complicated and only affects the few extensions that target the stable ABI and want to use API's introduced in 3.11.
You only have to do this update work once. Once you added the missing #include, the code remains compatible with older Python versions, and becomes "future proof" (no need to add again these include).
Comment on lines +567 to +570
| * The Python 3.11 limited C API no longer includes ``<stdlib.h>``, | ||
| ``<stdio.h>``, ``<errno.h>`` and ``<string.h>``: | ||
| if ``Py_LIMITED_API >= 0x030b0000``. C extensions using these headers must | ||
| now include them explicitly. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whatsnew entry is hard to understand.
| * The Python 3.11 limited C API no longer includes ``<stdlib.h>``, | |
| ``<stdio.h>``, ``<errno.h>`` and ``<string.h>``: | |
| if ``Py_LIMITED_API >= 0x030b0000``. C extensions using these headers must | |
| now include them explicitly. | |
| * ``<Python.h>`` no longer includes the header files ``<stdlib.h>``, | |
| ``<stdio.h>``, ``<errno.h>`` and ``<string.h>`` when ``Py_LIMITED_API`` | |
| is set to ``0x030b0000`` (3.11) or higher. C extensions should explicitly | |
| include the header files after ``#include <Python.h>``. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confess that it's hard to understand. I copied your rephrased paragraph, thanks.