summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 51e2f83..c1e2b40 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3073,6 +3073,7 @@ fix_imports(PyObject **module_name, PyObject **global_name)
Py_INCREF(fixed_global_name);
*module_name = fixed_module_name;
*global_name = fixed_global_name;
+ return 0;
}
else if (PyErr_Occurred()) {
return -1;
@@ -6324,20 +6325,21 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyObject *module_name,
else if (PyErr_Occurred()) {
return NULL;
}
-
- /* Check if the module was renamed. */
- item = PyDict_GetItemWithError(st->import_mapping_2to3, module_name);
- if (item) {
- if (!PyUnicode_Check(item)) {
- PyErr_Format(PyExc_RuntimeError,
- "_compat_pickle.IMPORT_MAPPING values should be "
- "strings, not %.200s", Py_TYPE(item)->tp_name);
+ else {
+ /* Check if the module was renamed. */
+ item = PyDict_GetItemWithError(st->import_mapping_2to3, module_name);
+ if (item) {
+ if (!PyUnicode_Check(item)) {
+ PyErr_Format(PyExc_RuntimeError,
+ "_compat_pickle.IMPORT_MAPPING values should be "
+ "strings, not %.200s", Py_TYPE(item)->tp_name);
+ return NULL;
+ }
+ module_name = item;
+ }
+ else if (PyErr_Occurred()) {
return NULL;
}
- module_name = item;
- }
- else if (PyErr_Occurred()) {
- return NULL;
}
}