diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-04 07:14:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-04 07:14:38 +0400 |
commit | 4f2976941fd7284c85e89c1de5038805e62a5c99 (patch) | |
tree | 41bdc00795a8ddb01684f95da7f2a8cba14ff496 /source | |
parent | 6c37e0a44261bf42f42e817411f773dde1d99dc3 (diff) |
fix for issue raise by patch [#30154] non utf8 buildinfo, fails to import 'bpy' module.
we cant ensure buildinfo to have utf8 encoding so access it as bytes via python - a different workaround then this patch made.
also use C style string formatting for sys_info.py
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 0641c220001..7cd672ba0c5 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -108,6 +108,8 @@ static PyObject *make_app_info(void) PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag)) #define SetStrItem(str) \ PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str)) +#define SetBytesItem(str) \ + PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str)) #define SetObjItem(obj) \ PyStructSequence_SET_ITEM(app_info, pos++, obj) @@ -121,27 +123,28 @@ static PyObject *make_app_info(void) SetStrItem(BLI_program_path()); SetObjItem(PyBool_FromLong(G.background)); - /* build info */ + /* build info, use bytes since we can't assume _any_ encoding: + * see patch [#30154] for issue */ #ifdef BUILD_DATE - SetStrItem(build_date); - SetStrItem(build_time); - SetStrItem(build_rev); - SetStrItem(build_platform); - SetStrItem(build_type); - SetStrItem(build_cflags); - SetStrItem(build_cxxflags); - SetStrItem(build_linkflags); - SetStrItem(build_system); + SetBytesItem(build_date); + SetBytesItem(build_time); + SetBytesItem(build_rev); + SetBytesItem(build_platform); + SetBytesItem(build_type); + SetBytesItem(build_cflags); + SetBytesItem(build_cxxflags); + SetBytesItem(build_linkflags); + SetBytesItem(build_system); #else - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); - SetStrItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); + SetBytesItem("Unknown"); #endif SetObjItem(BPY_app_ffmpeg_struct()); @@ -149,6 +152,7 @@ static PyObject *make_app_info(void) #undef SetIntItem #undef SetStrItem +#undef SetBytesItem #undef SetObjItem if (PyErr_Occurred()) { |