2121static PyObject * collections_abc_mapping ;
2222static PyObject * collections_abc_mut_mapping ;
2323static PyObject * collections_abc_mut_multi_mapping ;
24+ static PyObject * repr_func ;
2425
2526static PyTypeObject multidict_type ;
2627static PyTypeObject cimultidict_type ;
2728static PyTypeObject multidict_proxy_type ;
2829static PyTypeObject cimultidict_proxy_type ;
2930
30- static PyObject * repr_func ;
31-
3231#define MultiDict_CheckExact (o ) (Py_TYPE(o) == &multidict_type)
3332#define CIMultiDict_CheckExact (o ) (Py_TYPE(o) == &cimultidict_type)
3433#define MultiDictProxy_CheckExact (o ) (Py_TYPE(o) == &multidict_proxy_type)
@@ -1967,19 +1966,6 @@ PyInit__multidict(void)
19671966 PyObject * module = NULL ,
19681967 * reg_func_call_result = NULL ;
19691968
1970- #define WITH_MOD (NAME ) \
1971- Py_CLEAR(module); \
1972- module = PyImport_ImportModule(NAME); \
1973- if (module == NULL) { \
1974- goto fail; \
1975- }
1976-
1977- #define GET_MOD_ATTR (VAR , NAME ) \
1978- VAR = PyObject_GetAttrString(module, NAME); \
1979- if (VAR == NULL) { \
1980- goto fail; \
1981- }
1982-
19831969 if (multidict_views_init () < 0 ) {
19841970 goto fail ;
19851971 }
@@ -2000,18 +1986,31 @@ PyInit__multidict(void)
20001986 goto fail ;
20011987 }
20021988
1989+ #define WITH_MOD (NAME ) \
1990+ Py_CLEAR(module); \
1991+ module = PyImport_ImportModule(NAME); \
1992+ if (module == NULL) { \
1993+ goto fail; \
1994+ }
1995+
1996+ #define GET_MOD_ATTR (VAR , NAME ) \
1997+ VAR = PyObject_GetAttrString(module, NAME); \
1998+ if (VAR == NULL) { \
1999+ goto fail; \
2000+ }
2001+
20032002 WITH_MOD ("collections.abc" );
20042003 GET_MOD_ATTR (collections_abc_mapping , "Mapping" );
20052004
20062005 WITH_MOD ("multidict._abc" );
20072006 GET_MOD_ATTR (collections_abc_mut_mapping , "MultiMapping" );
2008-
2009- WITH_MOD ("multidict._abc" );
20102007 GET_MOD_ATTR (collections_abc_mut_multi_mapping , "MutableMultiMapping" );
20112008
20122009 WITH_MOD ("multidict._multidict_base" );
20132010 GET_MOD_ATTR (repr_func , "_mdrepr" );
20142011
2012+ Py_CLEAR (module ); \
2013+
20152014 /* Register in _abc mappings (CI)MultiDict and (CI)MultiDictProxy */
20162015 reg_func_call_result = PyObject_CallMethod (
20172016 collections_abc_mut_mapping ,
0 commit comments