gh-132775: Support Fallbacks in _PyObject_GetXIData() (gh-133482)

It now supports a "full" fallback to _PyFunction_GetXIData() and then `_PyPickle_GetXIData()`.  There's also room for other fallback modes if that later makes sense.
This commit is contained in:
Eric Snow 2025-05-21 07:23:48 -06:00 committed by GitHub
parent 0c5a8b0b55
commit 88f8102a8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 581 additions and 139 deletions

View file

@ -1143,7 +1143,7 @@ queue_put(_queues *queues, int64_t qid, PyObject *obj, int fmt, int unboundop)
_queue_unmark_waiter(queue, queues->mutex);
return -1;
}
if (_PyObject_GetXIData(tstate, obj, data) != 0) {
if (_PyObject_GetXIDataNoFallback(tstate, obj, data) != 0) {
_queue_unmark_waiter(queue, queues->mutex);
GLOBAL_FREE(data);
return -1;
@ -1270,7 +1270,7 @@ set_external_queue_type(module_state *state, PyTypeObject *queue_type)
}
// Add and register the new type.
if (ensure_xid_class(queue_type, _queueobj_shared) < 0) {
if (ensure_xid_class(queue_type, GETDATA(_queueobj_shared)) < 0) {
return -1;
}
state->queue_type = (PyTypeObject *)Py_NewRef(queue_type);