File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -11381,10 +11381,18 @@ update_all_slots(PyTypeObject* type)
1138111381int
1138211382_PyType_InitSlotDefsCache (PyInterpreterState * interp )
1138311383{
11384+ PyObject * cache ;
11385+ PyObject * bytes = NULL ;
11386+
1138411387 assert (!_Py_INTERP_CACHED_OBJECT (interp , slotdefs_cache ));
11388+ PyInterpreterState * main = interp -> runtime -> interpreters .main ;
11389+ if (interp != main ) {
11390+ cache = _Py_INTERP_CACHED_OBJECT (main , slotdefs_cache );
11391+ _Py_INTERP_CACHED_OBJECT (interp , slotdefs_cache ) = Py_NewRef (cache );
11392+ return 0 ;
11393+ }
1138511394
11386- PyObject * bytes = NULL ;
11387- PyObject * cache = PyDict_New ();
11395+ cache = PyDict_New ();
1138811396 if (!cache ) {
1138911397 goto error ;
1139011398 }
@@ -11431,7 +11439,7 @@ _PyType_InitSlotDefsCache(PyInterpreterState *interp)
1143111439 Py_CLEAR (bytes );
1143211440 }
1143311441
11434- Py_XSETREF ( _Py_INTERP_CACHED_OBJECT (interp , slotdefs_cache ), cache ) ;
11442+ _Py_INTERP_CACHED_OBJECT (interp , slotdefs_cache ) = cache ;
1143511443 return 0 ;
1143611444
1143711445error :
You can’t perform that action at this time.
0 commit comments