[Python-Dev] ParseTuple question

Mark Hammond skippy.hammond at gmail.com
Sun Jan 4 00:01:37 CET 2009

On 2/01/2009 10:32 PM, Ulrich Eckhardt wrote:
> Hi!
> I'm looking at NullImporter_init in import.c and especially at the call to
> PyArg_ParseTuple there. What I'm wondering is what that call will do when I
> call the function with a Unicode object. Will it convert the Unicode to a
> char string first, will it return the Unicode object in a certain (default)
> encoding, will it fail?

PyArg_ParseTuple will fail if a unicode object is passed where a 's' 
format string is specified.

> I'm working on the MS Windows CE port, and I don't have stat() there. Also, I
> don't have GetFileAttributesA(char const*) there, so I need a wchar_t
> (UTF-16) string anyway. What would be the best way to get one?

On 'normal' windows you generally would need to use 
WideCharToMultiByte() to get a 'char *' version of your wchar string - 
but I expect you already know that, so I doubt I understand the question...



More information about the Python-Dev mailing list