Skip to content

Commit

Permalink
Fix macros usage
Browse files Browse the repository at this point in the history
  • Loading branch information
iemelyanov committed Sep 2, 2023
1 parent 509cf3d commit d7499ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions multidict/_multidict.c
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,9 @@ getversion(PyObject *self, PyObject *md)
static inline void
module_free(void *m)
{
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 9
Py_CLEAR(multidict_str_lower);
#endif
Py_CLEAR(collections_abc_mapping);
Py_CLEAR(collections_abc_mut_mapping);
Py_CLEAR(collections_abc_mut_multi_mapping);
Expand Down Expand Up @@ -1695,10 +1697,12 @@ static PyModuleDef multidict_module = {
PyMODINIT_FUNC
PyInit__multidict()
{
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 9
multidict_str_lower = PyUnicode_InternFromString("lower");
if (multidict_str_lower == NULL) {
goto fail;
}
#endif

PyObject *module = NULL,
*reg_func_call_result = NULL;
Expand Down Expand Up @@ -1830,7 +1834,9 @@ PyInit__multidict()
return module;

fail:
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 9
Py_XDECREF(multidict_str_lower);
#endif
Py_XDECREF(collections_abc_mapping);
Py_XDECREF(collections_abc_mut_mapping);
Py_XDECREF(collections_abc_mut_multi_mapping);
Expand Down

0 comments on commit d7499ac

Please sign in to comment.