summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2011-03-23 16:14:42 -0700
committerBrett Cannon <brett@python.org>2011-03-23 16:14:42 -0700
commit725c21b3a4aec4426ccaa4c0425ee4e777a9eb35 (patch)
tree988bc9dd51f4efaf04b801a59d35642cbd8df398 /Python/pythonrun.c
parentc261629c30cb8b11c75c3ffcc06dea3934aa1078 (diff)
downloadcpython-725c21b3a4aec4426ccaa4c0425ee4e777a9eb35.tar.gz
Make importlib compatible with __import__ by "fixing" code.co_filename
paths. __import__ does a little trick when importing from bytecode by back-patching the co_filename paths to point to the file location where the code object was loaded from, *not* where the code object was originally created. This allows co_filename to point to a valid path. Problem is that co_filename is immutable from Python, so a private function -- imp._fix_co_filename() -- had to be introduced in order to get things working properly. Originally the plan was to add a file argument to marshal.loads(), but that failed as the algorithm used by __import__ is not fully recursive as one might expect, so to be fully backwards-compatible the code used by __import__ needed to be exposed. This closes issue #6811 by taking a different approach than outlined in the issue.
Diffstat (limited to 'Python/pythonrun.c')
0 files changed, 0 insertions, 0 deletions