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>2012-10-07 03:32:21 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-10-07 03:32:21 +0400
commit1fe70c07a008185c4e5925aff2c214c93ff396b7 (patch)
tree5dd9fc4a6be56243977b2670c8acfe4eb5543d96 /source/blender/python
parentcdc1e5a716c08e809b771388c6b5075d32a20c98 (diff)
parente7db06ad9db5a1a05b00fc835038d4366d637851 (diff)
Merged changes in the trunk up to revision 51126.
Conflicts resolved: source/blender/blenloader/intern/readfile.c source/blender/windowmanager/WM_types.h
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c2
-rw-r--r--source/blender/python/generic/py_capi_utils.c10
-rw-r--r--source/blender/python/intern/bpy_interface.c18
4 files changed, 19 insertions, 13 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index fefccceeb6e..fd5fa63647b 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -1808,7 +1808,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
f_new = BM_face_create(bm, vert_array, edge_array, vert_seq_len, FALSE);
- if (f_new == NULL) {
+ if (UNLIKELY(f_new == NULL)) {
PyErr_SetString(PyExc_ValueError,
"faces.new(verts): couldn't create the new face, internal error");
goto cleanup;
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 2a9592d21e2..0391839c763 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -1079,7 +1079,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
ret = -1;
}
else {
- BLI_strncpy(mstring->s, tmp_val, sizeof(mstring->s));
+ BLI_strncpy(mstring->s, tmp_val, MIN2(PyBytes_Size(py_value), sizeof(mstring->s)));
}
break;
}
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index a2521484c88..9492c8384dc 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -760,7 +760,6 @@ int PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int *valu
return 0;
}
-/* 'value' _must_ be a set type, error check before calling */
int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
{
/* set of enum items, concatenate all values with OR */
@@ -771,6 +770,13 @@ int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, co
Py_ssize_t hash = 0;
PyObject *key;
+ if (!PySet_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s expected a set, not %.200s",
+ error_prefix, Py_TYPE(value)->tp_name);
+ return -1;
+ }
+
*r_value = 0;
while (_PySet_NextEntry(value, &pos, &key, &hash)) {
@@ -778,7 +784,7 @@ int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, co
if (param == NULL) {
PyErr_Format(PyExc_TypeError,
- "%.200s expected a string, not %.200s",
+ "%.200s set must contain strings, not %.200s",
error_prefix, Py_TYPE(key)->tp_name);
return -1;
}
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 85f6163c721..b628f42e759 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -251,6 +251,10 @@ void BPY_python_start(int argc, const char **argv)
* an error, this is highly annoying, another stumbling block for devs,
* so use a more relaxed error handler and enforce utf-8 since the rest of
* blender is utf-8 too - campbell */
+
+ /* XXX, update: this is unreliable! 'PYTHONIOENCODING' is ignored in MS-Windows
+ * when dynamically linked, see: [#31555] for details.
+ * Python doesn't expose a good way to set this. */
BLI_setenv("PYTHONIOENCODING", "utf-8:surrogateescape");
/* Python 3.2 now looks for '2.xx/python/include/python3.2d/pyconfig.h' to
@@ -264,15 +268,6 @@ 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? */
{
@@ -678,6 +673,11 @@ void BPY_modules_load_user(bContext *C)
else {
Py_DECREF(module);
}
+
+ /* check if the script loaded a new file */
+ if (bmain != CTX_data_main(C)) {
+ break;
+ }
}
}
}