Fixed #1776. __import__() no longer imports modules by file name
diff --git a/Python/import.c b/Python/import.c
index d9550f5..71ec20a 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2055,6 +2055,16 @@
Py_ssize_t buflen = 0;
PyObject *parent, *head, *next, *tail;
+ if (strchr(name, '/') != NULL
+#ifdef MS_WINDOWS
+ || strchr(name, '\\') != NULL
+#endif
+ ) {
+ PyErr_SetString(PyExc_ImportError,
+ "Import by filename is not supported.");
+ return NULL;
+ }
+
parent = get_parent(globals, buf, &buflen, level);
if (parent == NULL)
return NULL;