Kaydet (Commit) b9ce7cd8 authored tarafından Tim Peters's avatar Tim Peters

save_global(): Trying to resolve module.name can fail for two

reasons:  importing module can fail, or the attribute lookup
module.name can fail.  We were giving the same error msg for
both cases, making it needlessly hard to guess what went wrong.
These cases give different error msgs now.
üst 97e5ff55
......@@ -2021,14 +2021,16 @@ save_global(Picklerobject *self, PyObject *args, PyObject *name)
mod = PyImport_ImportModule(module_str);
if (mod == NULL) {
cPickle_ErrFormat(PicklingError,
"Can't pickle %s: it's not found as %s.%s",
"OSS", args, module, global_name);
"Can't pickle %s: import of module %s "
"failed",
"OS", args, module);
goto finally;
}
klass = PyObject_GetAttrString(mod, name_str);
if (klass == NULL) {
cPickle_ErrFormat(PicklingError,
"Can't pickle %s: it's not found as %s.%s",
"Can't pickle %s: attribute lookup %s.%s "
"failed",
"OSS", args, module, global_name);
goto finally;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment