mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Remember source filename as <module>.__file__.
This commit is contained in:
parent
63e39ae933
commit
9c9a07c9c9
1 changed files with 3 additions and 0 deletions
|
@ -161,6 +161,9 @@ exec_code_module(name, co)
|
||||||
if (dictinsert(d, "__builtins__", getbuiltins()) != 0)
|
if (dictinsert(d, "__builtins__", getbuiltins()) != 0)
|
||||||
return NULL;
|
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? */
|
v = eval_code((codeobject *)co, d, d); /* XXX owner? */
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue