illume avatar illume committed 63551f1

Updated color slicing to work with python2.4 again.

Comments (0)

Files changed (1)

     (reprfunc) _color_repr,     /* tp_repr */
     &_color_as_number,          /* tp_as_number */
     &_color_as_sequence,        /* tp_as_sequence */
+#if PY_VERSION_HEX < 0x02050000
+    0,
+#else
     &_color_as_mapping,          /* tp_as_mapping */
+#endif
     0,                          /* tp_hash */
     0,                          /* tp_call */
     0,                          /* tp_str */
 
 static PyObject * _color_subscript(PyColor* self, PyObject* item) {
 
+
+#if PY_VERSION_HEX < 0x02050000
+    if (PyInt_Check(item)) {
+        Py_ssize_t i;
+        i = 0;
+#else
     if (PyIndex_Check(item)) {
         Py_ssize_t i;
         i = PyNumber_AsSsize_t(item, PyExc_IndexError);
+#endif
+
         if (i == -1 && PyErr_Occurred())
             return NULL;
         /*
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.