File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1938,39 +1938,46 @@ whichmodule(PyObject *global, PyObject *dotted_path)
1938
1938
i = 0 ;
1939
1939
while (PyDict_Next (modules , & i , & module_name , & module )) {
1940
1940
if (_checkmodule (module_name , module , global , dotted_path ) == 0 ) {
1941
+ Py_DECREF (modules );
1941
1942
return Py_NewRef (module_name );
1942
1943
}
1943
1944
if (PyErr_Occurred ()) {
1945
+ Py_DECREF (modules );
1944
1946
return NULL ;
1945
1947
}
1946
1948
}
1947
1949
}
1948
1950
else {
1949
1951
PyObject * iterator = PyObject_GetIter (modules );
1950
1952
if (iterator == NULL ) {
1953
+ Py_DECREF (modules );
1951
1954
return NULL ;
1952
1955
}
1953
1956
while ((module_name = PyIter_Next (iterator ))) {
1954
1957
module = PyObject_GetItem (modules , module_name );
1955
1958
if (module == NULL ) {
1956
1959
Py_DECREF (module_name );
1957
1960
Py_DECREF (iterator );
1961
+ Py_DECREF (modules );
1958
1962
return NULL ;
1959
1963
}
1960
1964
if (_checkmodule (module_name , module , global , dotted_path ) == 0 ) {
1961
1965
Py_DECREF (module );
1962
1966
Py_DECREF (iterator );
1967
+ Py_DECREF (modules );
1963
1968
return module_name ;
1964
1969
}
1965
1970
Py_DECREF (module );
1966
1971
Py_DECREF (module_name );
1967
1972
if (PyErr_Occurred ()) {
1968
1973
Py_DECREF (iterator );
1974
+ Py_DECREF (modules );
1969
1975
return NULL ;
1970
1976
}
1971
1977
}
1972
1978
Py_DECREF (iterator );
1973
1979
}
1980
+ Py_DECREF (modules );
1974
1981
1975
1982
/* If no module is found, use __main__. */
1976
1983
return & _Py_ID (__main__ );
You can’t perform that action at this time.
0 commit comments