diff options
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 @@ exec_code_module(name, co) 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; |