[Python-Dev] Assign to errno allowed?

Brad Clements bkc@murkworks.com
Tue, 24 Sep 2002 11:22:18 -0400

On 24 Sep 2002 at 10:16, Guido van Rossum wrote:

> Yes, assignment to errno is fine.

Please see patch 505846.

I haven't supplied this patch in proper form yet, but this discussion relates to the patch.

I would like to remind folks that on some platforms, one cannot just use "errno = 0". On 
those platforms calling a function is required to set errno.

The point of patch 505846 is to "standardized" the "errno = " function, and secondarily 
provide a way to "get" the errno. This is  done in pyport.h and "all modules" that use or 
set errno. (not as many as you might think)

It's an ugly patch, requires a lot of changes to the core. I'm willing to make all the 
changes to the core as needed, once we figure out the best way to handle this issue is.

In fact, it's this patch that is the principal cause of the "fork python ce" thread also 
recently discussed in this forum.  See "Need advice: cloning python cvs for CE project"  

Windows CE doesn't allow setting errno. Neither does NetWare (CLIB). 

Is it worthwhile to discuss patch 505846 some more in this thread? Perhaps those who 
haven't read the comments on the patch have a clever solution? 

Or should I just clean up my patch, resubmit it and move on?

I agree with Mark's post about keeping CE changes in the core. I'd rather do that. I 
submitted patch 505846 incorrectly and need to fix it.. But after it's submitted and if 
accepted, core developers would need to use Py_SetErrno instead of "errno = "

And for extension developers. Using the macro would be nice, but it's less of an issue 
since CE and NetWare ports have to be done "by hand" anyway for these modules, we 
can make those changes as they're encountered.

So .. discuss this, look for better insight, or resubmit the patch and move on?


Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
AOL-IM: BKClements