[Python-Dev] Assign to errno allowed?

Brad Clements bkc@murkworks.com
Wed, 25 Sep 2002 11:44:11 -0400


On 24 Sep 2002 at 21:29, Guido van Rossum wrote:


> Question.  You showed that errno was #defined as a call to the right
> function.  Why don't you leave *getting* errno alone?

Sorry I forgot to clarify that part.

Windows CE 1 and 2 have "errno", but in CE 3.0 they improved 
the OS by eliminating errno and replacing it with
GetLastError()

I suspect this was done to allow CE to be embedded on new
processor types that would not otherwise be supported.


> You talk of 100s of places using errno.  But how many places *set*
> errno?

In the modules dir, grep shows:

File cmathmodule.c:
        Py_SetErrno(0);
File cPickle.c:
        Py_SetErrno(0);
                Py_SetErrno(0);
        Py_SetErrno(0);
File mathmodule.c:
        Py_SetErrno(0);
        Py_SetErrno(0);
        Py_SetErrno(0);
        Py_SetErrno(0);
        Py_SetErrno(0);

But alas for the GetLastError() issue, this wouldn't be so bad.


> If you maintain a branch that uses the errno macro, you could merge
> the trunk into that branch each time you feel like synching up with
> the trunk.  That's a mostly mechanical process, certainly less than
> fixing 100s of errno uses manually each time.

I agree. I think this will be the best way to go.

> That's another problem.  Whenever there's a massive "peephole" change
> like this, there are always a few places that are broken but that no
> reviewer notices and that don't happen to be tested by the test suite.
> (After all, errno is only consulted when an error occurs, and some errors
> are darn hard to provoke.)

I hadn't considered that aspect of the issue.

--

Seems then that creating a new SF project to hold a "derivative work?" of
the core is the best way to go, but the only difference in this work is

a) using macros for errno

b) changing "finally" labels to something else.

Anyone have a good suggestion for the name of this proposed project? 

(or, would it be a branch of the core? I'm sorry, I'm still a cvs virgin)

I don't think making it CE specific is correct, since it would also be used for 
NetWare.


(oh, did I say 10 years for NetWare? I meant 19)


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