support any sequence type in init method of Vector class
This commit is contained in:
@@ -74,7 +74,7 @@ int VectorPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return 0;
|
||||
}
|
||||
PyErr_Clear(); // set by PyArg_ParseTuple()
|
||||
if (PyArg_ParseTuple(args,"O!",&(PyTuple_Type), &object)) {
|
||||
if (PyArg_ParseTuple(args,"O", &object)) {
|
||||
try {
|
||||
*ptr = getVectorFromTuple<double>(object);
|
||||
return 0;
|
||||
@@ -238,21 +238,21 @@ PyObject* VectorPy::richCompare(PyObject *v, PyObject *w, int op)
|
||||
Vector3d v2 = static_cast<VectorPy*>(w)->value();
|
||||
|
||||
PyObject *res=0;
|
||||
if (op != Py_EQ && op != Py_NE) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"no ordering relation is defined for Vector");
|
||||
return 0;
|
||||
}
|
||||
else if (op == Py_EQ) {
|
||||
res = (v1 == v2) ? Py_True : Py_False;
|
||||
if (op != Py_EQ && op != Py_NE) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"no ordering relation is defined for Vector");
|
||||
return 0;
|
||||
}
|
||||
else if (op == Py_EQ) {
|
||||
res = (v1 == v2) ? Py_True : Py_False;
|
||||
Py_INCREF(res);
|
||||
return res;
|
||||
}
|
||||
else {
|
||||
res = (v1 != v2) ? Py_True : Py_False;
|
||||
}
|
||||
else {
|
||||
res = (v1 != v2) ? Py_True : Py_False;
|
||||
Py_INCREF(res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// This always returns False
|
||||
|
||||
Reference in New Issue
Block a user