Jack Jansen wrote: > ... > So, I would like PyArg_Parse/Py_BuildValue formats that are symmetric to "s", > "s#" and "z" but that return wchar_t strings and that work with both > UnicodeObjects and StringObjects. How about this: we add a wchar_t codec to Python and the "eu#" parser marker. Then you could write: wchar_t value = NULL; int len = 0; if (PyArg_ParseTuple(tuple, "eu#", "wchar_t", &value, &len) < 0) return NULL; ... PyMem_Free(value); return ... or, for 8-bit strings: char value = NULL; int len = 0; if (PyArg_ParseTuple(tuple, "es#", "latin-1", &value, &len) < 0) return NULL; ... PyMem_Free(value); return ... Is that symmetric enough ? -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
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