[Bf-blender-cvs] [5f64b77] master: Fix T45955: Python's pdb can't show script source
Campbell Barton
noreply at git.blender.org
Mon Aug 31 15:49:32 CEST 2015
Commit: 5f64b77ca5235465b52183d2ea519606253a354e
Author: Campbell Barton
Date: Mon Aug 31 23:41:13 2015 +1000
Branches: master
https://developer.blender.org/rB5f64b77ca5235465b52183d2ea519606253a354e
Fix T45955: Python's pdb can't show script source
===================================================================
M source/blender/python/intern/bpy_interface.c
===================================================================
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 274b335..61477d0 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);
More information about the Bf-blender-cvs
mailing list