summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-28 20:11:45 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-28 20:11:45 (GMT)
commit0fd1291c38a8b8aed57bcdbf030fffe3fb42a241 (patch)
treee0ea4d52612860151f370bdffd2ea5dbbc6a3a58 /Python
parenta3f092751ae5f29957c78a7e86381532629c7fa3 (diff)
downloadcpython-0fd1291c38a8b8aed57bcdbf030fffe3fb42a241.zip
cpython-0fd1291c38a8b8aed57bcdbf030fffe3fb42a241.tar.gz
cpython-0fd1291c38a8b8aed57bcdbf030fffe3fb42a241.tar.bz2
The empty string is a valid import path.
(fixes #1496539)
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index e09365b..1a71b5c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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);