[Python-checkins] r46508 - python/trunk/Python/import.c

georg.brandl python-checkins at python.org
Sun May 28 22:11:45 CEST 2006


Author: georg.brandl
Date: Sun May 28 22:11:45 2006
New Revision: 46508

Modified:
   python/trunk/Python/import.c
Log:
The empty string is a valid import path.
 (fixes #1496539)



Modified: python/trunk/Python/import.c
==============================================================================
--- python/trunk/Python/import.c	(original)
+++ python/trunk/Python/import.c	Sun May 28 22:11:45 2006
@@ -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);


More information about the Python-checkins mailing list