[Python-Dev] Assign to errno allowed?

Guido van Rossum guido@python.org
Tue, 24 Sep 2002 12:21:13 -0400

> > 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.

Shucks.  That's in violation of the ISO C standard.

> 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)

Why also provide an alternative way to get it?  Sure you can *get* it
even on Win/CE?

> 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.

I have a strong urge to tell you to start porting Linux to your CE
hardware rather than bothering with Win/CE.  Or buy an iPAQ for which
Linux is already available.

> 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"

I've given all the advice I have time for.

> 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 = "

Except in extensions that don't have a snowball in hell's chance of
working on Win/CE, of course.

> 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?

As I said, I have a very strong urge to tell you to go away.  But I
won't.  But I really don't like the idea of coding around this
particular platform's quirks.

--Guido van Rossum (home page: http://www.python.org/~guido/)