File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2112,12 +2112,24 @@ static PyObject*
21122112defdict_or (PyObject * left , PyObject * right )
21132113{
21142114 PyObject * self , * other ;
2115- collections_state * state = find_module_state_by_def (Py_TYPE (left ));
2115+
2116+ // Find module state
2117+ PyTypeObject * tp = Py_TYPE (left );
2118+ PyObject * mod = PyType_GetModuleByDef (tp , & _collectionsmodule );
2119+ if (mod == NULL ) {
2120+ PyErr_Clear ();
2121+ tp = Py_TYPE (right );
2122+ mod = PyType_GetModuleByDef (tp , & _collectionsmodule );
2123+ }
2124+ assert (mod != NULL );
2125+ collections_state * state = get_module_state (mod );
2126+
21162127 if (PyObject_TypeCheck (left , state -> defdict_type )) {
21172128 self = left ;
21182129 other = right ;
21192130 }
21202131 else {
2132+ assert (PyObject_TypeCheck (right , state -> defdict_type ));
21212133 self = right ;
21222134 other = left ;
21232135 }
You can’t perform that action at this time.
0 commit comments