diff options
author | Guido van Rossum <guido@python.org> | 1996-05-16 20:43:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-05-16 20:43:40 (GMT) |
commit | 9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b (patch) | |
tree | f386d3fd5ff8414cf3ead649562ba984aee7e348 /Python | |
parent | 63e39ae933e415ed228dfed3b13514e6b513a2a9 (diff) | |
download | cpython-9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b.zip cpython-9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b.tar.gz cpython-9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b.tar.bz2 |
Remember source filename as <module>.__file__.
Diffstat (limited to 'Python')
-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; |