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*
2112
2112
defdict_or (PyObject * left , PyObject * right )
2113
2113
{
2114
2114
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
+
2116
2127
if (PyObject_TypeCheck (left , state -> defdict_type )) {
2117
2128
self = left ;
2118
2129
other = right ;
2119
2130
}
2120
2131
else {
2132
+ assert (PyObject_TypeCheck (right , state -> defdict_type ));
2121
2133
self = right ;
2122
2134
other = left ;
2123
2135
}
You can’t perform that action at this time.
0 commit comments