diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-08-31 16:41:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-08-31 16:41:13 +0300 |
commit | 5f64b77ca5235465b52183d2ea519606253a354e (patch) | |
tree | 20247d3a8d88811e626b66df6f39899f0298f5a1 /source/blender | |
parent | a603a3470c1ad18f5ceed3315aaec6cdc5c8e107 (diff) |
Fix T45955: Python's pdb can't show script source
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 274b33558d3..61477d0bd56 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -491,7 +491,9 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, * incompatible'. * So now we load the script file data to a buffer */ { - const char *pystring = "with open(__file__, 'r') as f: exec(f.read())"; + const char *pystring = + "ns = globals().copy()\n" + "with open(__file__, 'rb') as f: exec(compile(f.read(), __file__, 'exec'), ns)"; fclose(fp); |