[Python-Dev] Adding winerror module (Beta 1 schedule ?)

M.-A. Lemburg mal at egenix.com
Sun Jun 18 13:07:18 CEST 2006

Anthony Baxter wrote:
>> I'd also like to get the new winerror module in before
>> beta1 is released - documentation will follow next week:
> Hm. A new python module should be OK - but I was under the impression 
> that then large piles of the standard library would be updated to use 
> this new module. I'm less happy (much less) about this happening for 
> 2.5. 

I don't think that a lot of code currently uses the Windows
error codes. If code does use the Windows error codes, then
they usually hard-code the values in the module, so replacing
those values with ones from winerror wouldn't cause breakage.
winerror only contains mappings from error codes to error
names and vice-versa.

I agree, that it's a bit late in the 2.5 release process
to add a new module. Perhaps it should wait until 2.6.

Note that the module was motivated by a change Martin
implemented which now causes several os module APIs
to return Windows error codes rather than POSIX ones
(r45925). This was later reverted by Martin (r45964).
The Windows error codes are now available through
the .winerror attribute.

The winerror module is intended to be able to use symbolic
names for code using .winerror (much like the errno
serves this purpose for .errno).

>> Is it OK to first check in a pure Python version and then
>> replace this with a C implementation having the same interface
>> later on in the beta cycle ?
> How big is it likely to be? How much of a pain will it be to make it 
> work with various versions of Windows?

Not much: the C module will contain the same values as
the Python file (which are extracted from the standard
Windows WinError.h file).

The only difference is that the C module will use a static C
array to store the values, which results in less heap memory
being used.

Both modules are (will be) generated from the WinError.h file
(see the SF patch).

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Jun 18 2006)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Python-Dev mailing list