Was Re: [Python-Dev] unicode/string asymmetries

Thomas Heller thomas.heller@ion-tof.com
Wed, 9 Jan 2002 16:11:13 +0100


From: "Fred L. Drake, Jr." <fdrake@acm.org>
> 
> Jack Jansen writes:
>  > Huh, what did I miss? Why is PyArg_Parse deprecated, and by what
>  > should it be replaced?
> 
>   I think it is only recommended to avoid this as the argument-parsing
> function for an extension function/method; PyArg_ParseTuple() should
> be used instead since it can give better error messages using the
> :funcname syntax for the format string (which is strongly
> recommended!).

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'.

Should this be changed?

Thomas