diff options
author | Guido van Rossum <guido@python.org> | 1991-12-24 13:26:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-12-24 13:26:56 (GMT) |
commit | 4135e782041517e2de473fd9b6f5375878c48e68 (patch) | |
tree | 10784e1d0c1c4f44179001687573357e3436716c | |
parent | 201be057fb85a508679a0e51686355c29e5eea79 (diff) | |
download | cpython-4135e782041517e2de473fd9b6f5375878c48e68.zip cpython-4135e782041517e2de473fd9b6f5375878c48e68.tar.gz cpython-4135e782041517e2de473fd9b6f5375878c48e68.tar.bz2 |
Use IOError and ImportError when import fails.
-rw-r--r-- | Python/import.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c index 7725245..0eb44f2 100644 --- a/Python/import.c +++ b/Python/import.c @@ -149,10 +149,14 @@ get_module(m, name, m_ret) fp = open_module(name, ".py", namebuf); if (fp == NULL) { - if (m == NULL) - err_setstr(NameError, name); - else - err_setstr(IOError, "no module source file"); + if (m == NULL) { + sprintf(namebuf, "no module named %.200s", name); + err_setstr(ImportError, namebuf); + } + else { + sprintf(namebuf, "no source for module %.200s", name); + err_setstr(ImportError, namebuf); + } return NULL; } /* Get mtime -- always useful */ |