summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-05-16 20:43:40 (GMT)
committerGuido van Rossum <guido@python.org>1996-05-16 20:43:40 (GMT)
commit9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b (patch)
treef386d3fd5ff8414cf3ead649562ba984aee7e348 /Python/import.c
parent63e39ae933e415ed228dfed3b13514e6b513a2a9 (diff)
downloadcpython-9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b.zip
cpython-9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b.tar.gz
cpython-9c9a07c9c9a7532e1b89c80ab765cb3aade27d1b.tar.bz2
Remember source filename as <module>.__file__.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c3
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;