gh-132775: Add _PyBytes_GetXIData() (gh-133101)

This is the base for several other XIData wrappers, like pickle and marshal. It is essentially a refactor of the existing bytes XIData code.
This commit is contained in:
Eric Snow 2025-04-28 12:52:36 -06:00 committed by GitHub
parent 31d1342de9
commit 606003ffa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 99 additions and 14 deletions

View file

@ -154,7 +154,7 @@ _PyXIData_InitWithSize(_PyXIData_t *xidata,
// where it was allocated, so the interpreter is required.
assert(interp != NULL);
_PyXIData_Init(xidata, interp, NULL, obj, new_object);
xidata->data = PyMem_RawMalloc(size);
xidata->data = PyMem_RawCalloc(1, size);
if (xidata->data == NULL) {
return -1;
}