Commits

Lenard Lindstrom committed 3299e2c

fix problem in PixelArray with sequence item access

The PySequence_Fast_GET_ITEM macro assumes the sequence is a tuple or list.
This is not always the case. Replace with the more general PySequence_ITEM.

Comments (0)

Files changed (1)

         return -1;
     }
     for (x = 0; x < val_dim0; ++x) {
-        if (!_get_color_from_object(PySequence_Fast_GET_ITEM(val, x),
+        if (!_get_color_from_object(PySequence_ITEM(val, x),
                                     format, (val_colors + x))) {
             free (val_colors);
             return -1;
             return RAISE(PyExc_IndexError, "too many indices for the array");
         }
 
-        obj = PySequence_Fast_GET_ITEM(op, 0);
+        obj = PySequence_ITEM(op, 0);
         if (obj == Py_Ellipsis || obj == Py_None) {
             /* Operator is the ellipsis or None
              * array[...,XXX], array[None,XXX]
         }
 
         if (size == 2) {
-            obj = PySequence_Fast_GET_ITEM(op, 1);
+            obj = PySequence_ITEM(op, 1);
             if (obj == Py_Ellipsis || obj == Py_None) {
                 /* Operator is the ellipsis or None
                  * array[XXX,...], array[XXX,None]
             return -1;
         }
 
-        obj = PySequence_Fast_GET_ITEM(op, 0);
+        obj = PySequence_ITEM(op, 0);
         if (obj == Py_Ellipsis || obj == Py_None) {
             /* Operator is the ellipsis or None
              * array[...,XXX], array[None,XXX]
         }
 
         if (size == 2) {
-            obj = PySequence_Fast_GET_ITEM(op, 1);
+            obj = PySequence_ITEM(op, 1);
             if (obj == Py_Ellipsis || obj == Py_None) {
                 /* Operator is the ellipsis or None
                  * array[XXX,...], array[XXX,None]