diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-02-18 20:50:45 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-02-18 20:50:45 (GMT) |
commit | b9ce7cd8b8cea66e3ad062fb273efdbf14a7e4e0 (patch) | |
tree | 7069f1596f21d9cfc470c88e65f4505df5e69089 | |
parent | 97e5ff555e581e30c21f703bf5ca89402db6f557 (diff) | |
download | cpython-b9ce7cd8b8cea66e3ad062fb273efdbf14a7e4e0.zip cpython-b9ce7cd8b8cea66e3ad062fb273efdbf14a7e4e0.tar.gz cpython-b9ce7cd8b8cea66e3ad062fb273efdbf14a7e4e0.tar.bz2 |
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.
-rw-r--r-- | Modules/cPickle.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c index ad087a9..0d78e49 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -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; } |