diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-26 12:57:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-26 12:57:28 +0300 |
commit | f2a8b74c2572258391c5847c177e59266aee3dab (patch) | |
tree | 0b3d7d1822beb32d335b0689bb04bb0a3a36f98c /source/blender/python | |
parent | 3b24ece297afc8ee648f91dbbe890d8aaee7e3bc (diff) | |
parent | f78ba0df02a9734740d7ccddbe315020f56852f6 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 15 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 55e477b0214..7b0daa91523 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -480,11 +480,20 @@ static bool python_script_exec( * object, but as written in the Python/C API Ref Manual, chapter 2, * 'FILE structs for different C libraries can be different and * incompatible'. - * So now we load the script file data to a buffer */ + * So now we load the script file data to a buffer. + * + * Note on use of 'globals()', it's important not copy the dictionary because + * tools may inspect 'sys.modules["__main__"]' for variables defined in the code + * where using a copy of 'globals()' causes code execution + * to leave the main namespace untouched. see: T51444 + * + * This leaves us with the problem of variables being included, + * currently this is worked around using 'dict.__del__' it's ugly but works. + */ { const char *pystring = - "ns = globals().copy()\n" - "with open(__file__, 'rb') as f: exec(compile(f.read(), __file__, 'exec'), ns)"; + "with open(__file__, 'rb') as f:" + "exec(compile(f.read(), __file__, 'exec'), globals().__delitem__('f') or globals())"; fclose(fp); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index bfd23af257b..e368e8871f3 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1709,10 +1709,10 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args) /* TODO, different sized matrix */ if (self->num_col == 4 && self->num_row == 4) { - blend_m4_m4m4((float (*)[4])mat, (float (*)[4])self->matrix, (float (*)[4])mat2->matrix, fac); + interp_m4_m4m4((float (*)[4])mat, (float (*)[4])self->matrix, (float (*)[4])mat2->matrix, fac); } else if (self->num_col == 3 && self->num_row == 3) { - blend_m3_m3m3((float (*)[3])mat, (float (*)[3])self->matrix, (float (*)[3])mat2->matrix, fac); + interp_m3_m3m3((float (*)[3])mat, (float (*)[3])self->matrix, (float (*)[3])mat2->matrix, fac); } else { PyErr_SetString(PyExc_ValueError, |