diff options
Diffstat (limited to 'libdimension-python/Vector.c')
-rw-r--r-- | libdimension-python/Vector.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libdimension-python/Vector.c b/libdimension-python/Vector.c index 8cd7f05..3fdc90c 100644 --- a/libdimension-python/Vector.c +++ b/libdimension-python/Vector.c @@ -24,8 +24,22 @@ bool dmnsn_py_Vector_args(dmnsn_vector *v, PyObject *args, PyObject *kwds) { static char *kwlist[] = { "x", "y", "z", NULL }; - return PyArg_ParseTupleAndKeywords(args, kwds, "ddd", kwlist, - &v->x, &v->y, &v->z); + if (PyArg_ParseTupleAndKeywords(args, kwds, "ddd", kwlist, + &v->x, &v->y, &v->z)) { + return true; + } else { + if (kwds) + return false; + + PyErr_Clear(); + + dmnsn_py_Vector *vec; + if (!PyArg_ParseTuple(args, "O!", &dmnsn_py_VectorType, &vec)) + return false; + + *v = vec->v; + return true; + } } static int |