]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use IOError and ImportError when import fails.
authorGuido van Rossum <guido@python.org>
Tue, 24 Dec 1991 13:26:56 +0000 (13:26 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 24 Dec 1991 13:26:56 +0000 (13:26 +0000)
Python/import.c

index 77252459d913eb7614dcd22ae6ccaca1c0561eea..0eb44f231133dabd7bdc508aa38c7a921bdcfbca 100644 (file)
@@ -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 */