Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 510:cbcdfda05bc4 legacy-trunk
Use IOError and ImportError when import fails.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 24 Dec 1991 13:26:56 +0000 |
| parents | 2ce6a2a31886 |
| children | 0ad5b35e3ad8 |
line wrap: on
line diff
--- a/Python/import.c Tue Dec 24 13:26:41 1991 +0000 +++ b/Python/import.c Tue Dec 24 13:26:56 1991 +0000 @@ -149,10 +149,14 @@ 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 */
