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:
-rw-r--r--intern/audaspace/Python/AUD_PyAPI.cpp22
-rw-r--r--source/blender/python/generic/IDProp.c2
-rw-r--r--source/blender/python/generic/bgl.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c4
-rw-r--r--source/blender/python/intern/bpy_rna_array.c12
5 files changed, 25 insertions, 19 deletions
diff --git a/intern/audaspace/Python/AUD_PyAPI.cpp b/intern/audaspace/Python/AUD_PyAPI.cpp
index 928c67c5196..3ec088053ca 100644
--- a/intern/audaspace/Python/AUD_PyAPI.cpp
+++ b/intern/audaspace/Python/AUD_PyAPI.cpp
@@ -848,6 +848,8 @@ Factory_filter(Factory* self, PyObject* args)
{
PyObject* py_b;
PyObject* py_a = NULL;
+ Py_ssize_t py_a_len;
+ Py_ssize_t py_b_len;
if(!PyArg_ParseTuple(args, "O|O:filter", &py_b, &py_a))
return NULL;
@@ -858,7 +860,10 @@ Factory_filter(Factory* self, PyObject* args)
return NULL;
}
- if(!PySequence_Size(py_b) || (py_a != NULL && !PySequence_Size(py_a)))
+ py_a_len= py_a ? PySequence_Size(py_a) : 0;
+ py_b_len= PySequence_Size(py_b);
+
+ if(!py_b_len || ((py_a != NULL) && !py_b_len))
{
PyErr_SetString(PyExc_ValueError, "The sequence has to contain at least one value!");
return NULL;
@@ -867,30 +872,31 @@ Factory_filter(Factory* self, PyObject* args)
std::vector<float> a, b;
PyObject* py_value;
float value;
- int result;
- for(int i = 0; i < PySequence_Size(py_b); i++)
+ for(Py_ssize_t i = 0; i < py_b_len; i++)
{
py_value = PySequence_GetItem(py_b, i);
- result = PyArg_Parse(py_value, "f:filter", &value);
+ value= (float)PyFloat_AsDouble(py_value);
Py_DECREF(py_value);
- if(!result)
+ if (value==-1.0f && PyErr_Occurred()) {
return NULL;
+ }
b.push_back(value);
}
if(py_a)
{
- for(int i = 0; i < PySequence_Size(py_a); i++)
+ for(Py_ssize_t i = 0; i < py_a_len; i++)
{
py_value = PySequence_GetItem(py_a, i);
- result = PyArg_Parse(py_value, "f:filter", &value);
+ value= (float)PyFloat_AsDouble(py_value);
Py_DECREF(py_value);
- if(!result)
+ if (value==-1.0f && PyErr_Occurred()) {
return NULL;
+ }
a.push_back(value);
}
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index 2543d34f58c..e6883eb30af 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -269,7 +269,7 @@ static int idp_sequence_type(PyObject *seq)
PyObject *item;
int type= IDP_INT;
- int i, len = PySequence_Size(seq);
+ Py_ssize_t i, len = PySequence_Size(seq);
for (i=0; i < len; i++) {
item = PySequence_GetItem(seq, i);
if (PyFloat_Check(item)) {
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 44d42a479ec..35c211d5424 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -286,8 +286,8 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
Buffer *buffer;
int dimensions[MAX_DIMENSIONS];
- int i, type;
- int ndimensions = 0;
+ int type;
+ Py_ssize_t i, ndimensions = 0;
if(kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 3175c0d088e..bcbd7670e2c 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1718,7 +1718,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
case PROP_COLLECTION:
{
- int seq_len, i;
+ Py_ssize_t seq_len, i;
PyObject *item;
PointerRNA itemptr;
ListBase *lb;
@@ -1736,7 +1736,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
seq_len= PySequence_Size(value);
- for(i=0; i<seq_len; i++) {
+ for(i=0; i < seq_len; i++) {
item= PySequence_GetItem(value, i);
if(item==NULL) {
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index e50ce233671..cab57724d6d 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -61,12 +61,12 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *)
static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[],
ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix)
{
- int i;
+ Py_ssize_t i;
/* not the last dimension */
if (dim + 1 < totdim) {
/* check that a sequence contains dimsize[dim] items */
- const int seq_size= PySequence_Size(seq);
+ const Py_ssize_t seq_size= PySequence_Size(seq);
if(seq_size == -1) {
PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'",
error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
@@ -147,8 +147,8 @@ static int count_items(PyObject *seq, int dim)
int totitem= 0;
if(dim > 1) {
- const int seq_size= PySequence_Size(seq);
- int i;
+ const Py_ssize_t seq_size= PySequence_Size(seq);
+ Py_ssize_t i;
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);
if(item) {
@@ -281,9 +281,9 @@ static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *pro
static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int dim, char *data, unsigned int item_size, int *index, ItemConvertFunc convert_item, RNA_SetIndexFunc rna_set_index)
{
- unsigned int i;
int totdim= RNA_property_array_dimension(ptr, prop, NULL);
- const int seq_size= PySequence_Size(seq);
+ const Py_ssize_t seq_size= PySequence_Size(seq);
+ Py_ssize_t i;
/* Regarding PySequence_GetItem() failing.
*