[Python-Dev] unicode/string asymmetries

Martin v. Loewis martin@v.loewis.de
Wed, 9 Jan 2002 22:24:28 +0100


> 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;

Wouldn't that code be incorrect if there are further format argument
whose conversion could fail also?

I think format specifiers that require explicit memory management are
so difficult to use that they must be avoided. I'd be in favour of
extending the argtuple type to include additional slots for objects
that go away when the tuple goes away.

Regards,
Martin