Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-03-05 20:27:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-03-05 20:31:00 +0400
commita8dc5b274b5105be96694a9ea1a70871b5a7183f (patch)
treeb2fc82905e140adbcb00c3658b920bab40ea77bc
parent4f1a6eb96f44aaf13217d806abed646cd2e3f470 (diff)
Alternative fix for T38753, use existing __file__ in namespace
-rw-r--r--source/blender/python/intern/bpy_interface.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index cf5bf3aca9c..93bced364d2 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -496,19 +496,11 @@ 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 */
{
- PyObject *py_dict_local, *fn_py;
- const char *pystring = "with open(fn, 'r') as f: exec(f.read())";
+ const char *pystring = "with open(__file__, 'r') as f: exec(f.read())";
fclose(fp);
- py_dict_local = PyDict_New();
- fn_py = PyC_UnicodeFromByte(fn);
- PyDict_SetItemString(py_dict_local, "fn", fn_py);
- Py_DECREF(fn_py);
-
- py_result = PyRun_String(pystring, Py_file_input, py_dict, py_dict_local);
-
- Py_DECREF(py_dict_local);
+ py_result = PyRun_String(pystring, Py_file_input, py_dict, py_dict);
}
#else
py_result = PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);