diff Python/import.c @ 38465:3204aa9e2b22 legacy-trunk

The empty string is a valid import path. (fixes #1496539)
author Georg Brandl <georg@python.org>
date Sun, 28 May 2006 20:11:45 +0000
parents d21896b2dd0a
children 9268c30782c0
line wrap: on
line diff
--- a/Python/import.c	Sun May 28 19:13:17 2006 +0000
+++ b/Python/import.c	Sun May 28 20:11:45 2006 +0000
@@ -1251,9 +1251,11 @@
 			}
 			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);