diff Python/import.c @ 8012:2b09a5d26368 legacy-trunk

Reject empty module names -- otherwise __import__("") does something weird!
author Guido van Rossum <guido@python.org>
date Sat, 11 Apr 1998 17:38:22 +0000
parents 697df93e5ddb
children 7a1e7da922f8
line wrap: on
line diff
--- a/Python/import.c	Sat Apr 11 16:58:26 1998 +0000
+++ b/Python/import.c	Sat Apr 11 17:38:22 1998 +0000
@@ -1515,6 +1515,11 @@
 		*p_name = dot+1;
 		len = dot-name;
 	}
+	if (len == 0) {
+		PyErr_SetString(PyExc_ValueError,
+				"Empty module name");
+		return NULL;
+	}
 
 	p = buf + *p_buflen;
 	if (p != buf)