summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 27d06cc..4a4c5bf 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -2372,6 +2372,14 @@ _PyTypes_InitTypes(PyInterpreterState *interp)
}
}
+ // Cache __reduce__ from PyBaseObject_Type object
+ PyObject *baseobj_dict = _PyType_GetDict(&PyBaseObject_Type);
+ PyObject *baseobj_reduce = PyDict_GetItemWithError(baseobj_dict, &_Py_ID(__reduce__));
+ if (baseobj_reduce == NULL && PyErr_Occurred()) {
+ return _PyStatus_ERR("Can't get __reduce__ from base object");
+ }
+ _Py_INTERP_CACHED_OBJECT(interp, objreduce) = baseobj_reduce;
+
// Must be after static types are initialized
if (_Py_initialize_generic(interp) < 0) {
return _PyStatus_ERR("Can't initialize generic types");