disabling foreach_get/set for python2.x, since it uses new buffer api.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 30 Jun 2009 21:59:21 +0000 (21:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 30 Jun 2009 21:59:21 +0000 (21:59 +0000)
source/blender/python/intern/bpy_rna.c

index 53f7f532b8be422cfa33dcf5edec8ce24ac393c7..e13f02c5529ffe9f245b331a153b9d91d924944b 100644 (file)
@@ -1225,6 +1225,7 @@ static PyObject *pyrna_prop_values(BPy_PropertyRNA *self)
        return ret;
 }
 
+#if (PY_VERSION_HEX >= 0x03000000) /* foreach needs py3 */
 static void foreach_attr_type( BPy_PropertyRNA *self, char *attr,
                                                                        /* values to assign */
                                                                        RawPropertyType *raw_type, int *attr_tot, int *attr_signed )
@@ -1457,7 +1458,7 @@ static  PyObject *pyrna_prop_foreach_set(BPy_PropertyRNA *self, PyObject *args)
 {
        return foreach_getset(self, args, 1);
 }
-
+#endif /* #if (PY_VERSION_HEX >= 0x03000000) */
 
 /* A bit of a kludge, make a list out of a collection or array,
  * then return the lists iter function, not especially fast but convenient for now */
@@ -1502,9 +1503,11 @@ static struct PyMethodDef pyrna_prop_methods[] = {
        {"items", (PyCFunction)pyrna_prop_items, METH_NOARGS,NULL},
        {"values", (PyCFunction)pyrna_prop_values, METH_NOARGS, NULL},
 
+#if (PY_VERSION_HEX >= 0x03000000)
        /* array accessor function */
        {"foreach_get", (PyCFunction)pyrna_prop_foreach_get, METH_VARARGS, NULL},
        {"foreach_set", (PyCFunction)pyrna_prop_foreach_set, METH_VARARGS, NULL},
+#endif
        {NULL, NULL, 0, NULL}
 };