Thomas Heller wrote: > Offtopic again: PyArg_ParseTuple() is also nice for parsing a tuple > in C code, which you for example receive as a result from calling a method. > IIRC the only problem here is that it may throw weird error > messages if the object is not a tuple. > Instead of 'TypeError: unpack non-sequence' you get a > 'SystemError: new style getargs format but argument is not a tuple'. You can do that with PyArg_Parse(), too, if you point parens around your format string, as in this converter function: int CGPoint_Convert(PyObject *v, CGPoint *p_itself) { if( !PyArg_Parse(v, "(ff)", &p_itself->x, &p_itself->y) ) return 0; return 1; } The nice is that this will accept _any_ (length 2) sequence, not just tuples! So this seems to be a case where PyArg_Parse() is actually better than PyArg_ParseTuple(). Just
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4