diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-15 04:15:24 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-15 04:15:24 +0400 |
commit | 41729976753523ee08a0afaf6a26b6caf3dee1d6 (patch) | |
tree | ba264fba22084f44eb50b952f375715f501acff9 /source/blender/python | |
parent | a5f8298ea5d13d7707bc0cbf0722013276bab9d6 (diff) | |
parent | a425790065fedb2ae49f1b79770945d8528790d9 (diff) |
Merged changes in the trunk up to revision 50607.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/bgl.c | 2 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 9 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 18 |
3 files changed, 28 insertions, 1 deletions
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index ce11545c90d..45b767c6eda 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -44,7 +44,7 @@ #include "BLI_utildefines.h" static PyObject *Buffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds); -static PyObject *Method_ShaderSource (PyObject *self, PyObject *args); +static PyObject *Method_ShaderSource(PyObject *self, PyObject *args); /* Buffer sequence methods */ diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 520773c1ddf..2e4d4e870b8 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -402,6 +402,15 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) if (PyBytes_Check(py_str)) { return PyBytes_AS_STRING(py_str); } +#ifdef WIN32 + /* bug [#31856] oddly enough, Python3.2 --> 3.3 on Windows will throw an + * exception here this needs to be fixed in python: + * see: bugs.python.org/issue15859 */ + else if (!PyUnicode_Check(py_str)) { + PyErr_BadArgument(); + return NULL; + } +#endif else if ((*coerce = PyUnicode_EncodeFSDefault(py_str))) { return PyBytes_AS_STRING(*coerce); } diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index aa9d81389da..9cd0bdd090a 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -163,8 +163,17 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) void BPY_text_free_code(Text *text) { if (text->compiled) { + PyGILState_STATE gilstate; + int use_gil = !PYC_INTERPRETER_ACTIVE; + + if (use_gil) + gilstate = PyGILState_Ensure(); + Py_DECREF((PyObject *)text->compiled); text->compiled = NULL; + + if (use_gil) + PyGILState_Release(gilstate); } } @@ -254,6 +263,15 @@ void BPY_python_start(int argc, const char **argv) Py_Initialize(); +#ifdef WIN32 + /* this is disappointing, its likely a bug in python? + * for some reason 'PYTHONIOENCODING' is ignored in windows + * see: [#31555] for details. */ + PyRun_SimpleString("import sys, io\n" + "sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='surrogateescape', line_buffering=True)\n" + "sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='surrogateescape', line_buffering=True)\n"); +#endif /* WIN32 */ + // PySys_SetArgv(argc, argv); // broken in py3, not a huge deal /* sigh, why do python guys not have a (char **) version anymore? */ { |