◐ Shell
clean mode source ↗

gh-121617: Include <string.h> for Py_CLEAR() macro by vstinner · Pull Request #144666 · python/cpython

If the _Py_TYPEOF macro is not available, include <string.h> to get
memcpy() for the Py_CLEAR() macro. The limited C API version 3.11 and
newer doesn't include <string.h> anymore.

Add a Py_CLEAR() test in test_cext.

Modify also _Py_TYPEOF to use C23 typeof() if available.

@vstinner

@vstinner

@vstinner

thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request

Feb 15, 2026
Python.h now also includes <string.h> in the limited C API version 3.11
and newer to fix the Py_CLEAR() macro which uses memcpy().

Add a Py_CLEAR() test in test_cext.

Modify also _Py_TYPEOF to use C23 typeof() if available.

brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request

Feb 28, 2026
Python.h now also includes <string.h> in the limited C API version 3.11
and newer to fix the Py_CLEAR() macro which uses memcpy().

Add a Py_CLEAR() test in test_cext.

Modify also _Py_TYPEOF to use C23 typeof() if available.

ljfp pushed a commit to ljfp/cpython that referenced this pull request

Apr 25, 2026
Python.h now also includes <string.h> in the limited C API version 3.11
and newer to fix the Py_CLEAR() macro which uses memcpy().

Add a Py_CLEAR() test in test_cext.

Modify also _Py_TYPEOF to use C23 typeof() if available.