Commit 5f2c5081 authored by Zackery Spytz's avatar Zackery Spytz Committed by Serhiy Storchaka

bpo-36150: Fix possible assertion failures due to _ctypes.c's PyCData_reduce(). (GH-12106)

parent 48600c72
...@@ -2743,10 +2743,11 @@ PyCData_reduce(PyObject *myself, PyObject *args) ...@@ -2743,10 +2743,11 @@ PyCData_reduce(PyObject *myself, PyObject *args)
"ctypes objects containing pointers cannot be pickled"); "ctypes objects containing pointers cannot be pickled");
return NULL; return NULL;
} }
return Py_BuildValue("O(O(NN))", PyObject *dict = PyObject_GetAttrString(myself, "__dict__");
_unpickle, if (dict == NULL) {
Py_TYPE(myself), return NULL;
PyObject_GetAttrString(myself, "__dict__"), }
return Py_BuildValue("O(O(NN))", _unpickle, Py_TYPE(myself), dict,
PyBytes_FromStringAndSize(self->b_ptr, self->b_size)); PyBytes_FromStringAndSize(self->b_ptr, self->b_size));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment