* Added matrix module
* Moved the function EXPP_tuple_repr from vector.c to gen_utils.[ch] * Matrix functionality should work now in Object module. * Fixed compilation warning about implicit declaration of M_World_Init. Added the declaration to modules.h
This commit is contained in:
@@ -188,3 +188,34 @@ int EXPP_check_sequence_consistency(PyObject *seq, PyTypeObject *against)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
PyObject *EXPP_tuple_repr(PyObject *self, int size)
|
||||
{
|
||||
PyObject *repr, *comma, *item;
|
||||
int i;
|
||||
|
||||
/*@ note: a value must be built because the list is decrefed!
|
||||
* otherwise we have nirvana pointers inside python.. */
|
||||
|
||||
repr = PyString_FromString("(");
|
||||
if (!repr) return 0;
|
||||
|
||||
item = PySequence_GetItem(self, 0);
|
||||
PyString_ConcatAndDel(&repr, PyObject_Repr(item));
|
||||
Py_DECREF(item);
|
||||
|
||||
comma = PyString_FromString(", ");
|
||||
|
||||
for (i = 1; i < size; i++) {
|
||||
PyString_Concat(&repr, comma);
|
||||
item = PySequence_GetItem(self, i);
|
||||
PyString_ConcatAndDel(&repr, PyObject_Repr(item));
|
||||
Py_DECREF(item);
|
||||
}
|
||||
|
||||
PyString_ConcatAndDel(&repr, PyString_FromString(")"));
|
||||
Py_DECREF(comma);
|
||||
|
||||
return repr;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user