diff --git a/etg/colour.py b/etg/colour.py index 25110c79..339c616f 100644 --- a/etg/colour.py +++ b/etg/colour.py @@ -198,17 +198,7 @@ def run(): return 1; if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) return 1; - if (PyTuple_Check(sipPy) || PyList_Check(sipPy)) { - size_t len = PySequence_Size(sipPy); - if (len != 3 && len != 4) - return 0; - // ensure all the items in the sequence are numbers - for (int idx=0; idxob_type->tp_name, "numpy.ndarray") != 0) + return false; + } + + // Bail out here if the length isn't given + if (reqLength == -1) + return true; + + // Now check that the length matches the expected length + if (PySequence_Length(obj) != reqLength) + return false; + + // Check that each item is a number + for (int i=0; i