Remember source filename as <module>.__file__.
diff --git a/Python/import.c b/Python/import.c
index 18968d0..afaaab7 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -161,6 +161,9 @@
 		if (dictinsert(d, "__builtins__", getbuiltins()) != 0)
 			return NULL;
 	}
+	/* Remember the filename as the __file__ attribute */
+	if (dictinsert(d, "__file__", ((codeobject *)co)->co_filename) != 0)
+		err_clear(); /* Not important enough to report */
 	v = eval_code((codeobject *)co, d, d); /* XXX owner? */
 	if (v == NULL)
 		return NULL;