]> granicus.if.org Git - python/commitdiff
The empty string is a valid import path.
authorGeorg Brandl <georg@python.org>
Sun, 28 May 2006 20:11:45 +0000 (20:11 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 28 May 2006 20:11:45 +0000 (20:11 +0000)
 (fixes #1496539)

Python/import.c

index e09365b8c995c02276a39f10881ec2de13af4733..1a71b5cf6b30ad5096a2fbc22e6d5c918adc1f71 100644 (file)
@@ -1251,9 +1251,11 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
                        }
                        else if (importer == Py_None) {
                                /* No importer was found, so it has to be a file.
-                                * Check if the directory is valid. */
+                                * Check if the directory is valid.
+                                * Note that the empty string is a valid path, but
+                                * not stat'able, hence the check for len. */
 #ifdef HAVE_STAT
-                               if (stat(buf, &statbuf) != 0) {
+                               if (len && stat(buf, &statbuf) != 0) {
                                        /* Directory does not exist. */
                                        PyDict_SetItem(path_importer_cache,
                                                       v, Py_False);