-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
gh-121617: Include <string.h> for Py_CLEAR() macro #144666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
|
If this change is merged in the main branch, I will write a backport to the 3.14 branch without the C23 change using |
|
Note: |
|
The documentation also needs an update. (3.14 has the list here.) It's somewhat hard to explain, unfortunately. Is it enough to add something vague like “ |
|
I added the following sentence to the doc:
I'm not sure if it's worth it to document this corner case. |
|
It looks hard to explain. Is it a good idea? Looking more into this, I see
Plus, I think we want to be able to use I think we should go ahead and always include |
Ok, let's do that. |
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.
memcpy()usage without#include <string.h>inpwdmodule.c#121617