[Python-Dev] FormatError() in callproc.c under win32

Ulrich Eckhardt eckhardt at satorlaser.com
Tue Jan 27 12:16:01 CET 2009


On Monday 26 January 2009, Martin v. Löwis wrote:
> > In callproc.c from trunk is a function called SetException(), which calls
> > FormatError() only to discard the contents. Can anyone enlighten me to
> > the reasons thereof?
>
> Interestingly enough, the code used to say
>
>    PyErr_SetString(PyExc_WindowsError, lpMsgBuf);
>
> Then it was changed to its current form, with a log message of
>
>    Changes for windows CE, contributed by Luke Dunstan.  Thanks a lot!
>
> See
>
> 
http://ctypes.cvs.sourceforge.net/viewvc/ctypes/ctypes/source/callproc.c?hideattic=0&r1=1.127.2.15&r2=1.127.2.16
>
> I suggest you ask Thomas Heller and Luke Dunstan (if available) what the
> rationale for this partial change was.

I can only guess:
1. Those changes seem to generate TCHAR strings. This is necessary to compile 
it on both win9x (TCHAR=char) and CE (TCHAR=wchar_t). Since win9x was dropped 
from the supported platforms, that isn't necessary any more and all the code 
could use WCHAR directly.
2. Those changes also seem to change a few byte-strings to Unicode-strings, 
see format_error(). This is a questionable step, since those are changes that 
are visible to Python code. Worse, even on the same platform it could return 
different string types when the lookup of the errorcode fails. I wonder if 
that is intentional.

In any case, CCing Luke on the issue, maybe he can clarify things.

cheers

Uli

**************************************************************************************
Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************



More information about the Python-Dev mailing list