@@ -1959,10 +1959,10 @@ whichmodule(PickleState *st, PyObject *global, PyObject *global_name, PyObject *
1959
1959
extra parameters of __import__ to fix that. */
1960
1960
module = PyImport_Import (module_name );
1961
1961
if (module == NULL ) {
1962
- Py_DECREF (module_name );
1963
1962
PyErr_Format (st -> PicklingError ,
1964
1963
"Can't pickle %R: import of module %R failed" ,
1965
1964
global , module_name );
1965
+ Py_DECREF (module_name );
1966
1966
return NULL ;
1967
1967
}
1968
1968
if (check_dotted_path (module , global_name , dotted_path ) < 0 ) {
@@ -1973,18 +1973,18 @@ whichmodule(PickleState *st, PyObject *global, PyObject *global_name, PyObject *
1973
1973
PyObject * actual = getattribute (module , dotted_path );
1974
1974
Py_DECREF (module );
1975
1975
if (actual == NULL ) {
1976
- Py_DECREF (module_name );
1977
1976
PyErr_Format (st -> PicklingError ,
1978
1977
"Can't pickle %R: attribute lookup %S on %S failed" ,
1979
1978
global , global_name , module_name );
1979
+ Py_DECREF (module_name );
1980
1980
return NULL ;
1981
1981
}
1982
1982
if (actual != global ) {
1983
1983
Py_DECREF (actual );
1984
- Py_DECREF (module_name );
1985
1984
PyErr_Format (st -> PicklingError ,
1986
1985
"Can't pickle %R: it's not the same object as %S.%S" ,
1987
1986
global , module_name , global_name );
1987
+ Py_DECREF (module_name );
1988
1988
return NULL ;
1989
1989
}
1990
1990
Py_DECREF (actual );
0 commit comments