[Python-Dev] Assign to errno allowed?

Mark Hammond mhammond@skippinet.com.au
Tue, 24 Sep 2002 23:49:05 +1000


> but PyErr_SetExcFromWindowsErr is not present in the 2.2
> maintainance branch. An easier fix would be this one, but
> I wonder if it is allowed/good style to set 'errno':
>
> *** 274,279 ****
> --- 274,282 ----
>    Py_END_ALLOW_THREADS
>
>    if (n < 0) {
> + #ifdef MS_WINDOWS
> +   errno = WSAGetLastError();
> + #endif
>     PyErr_SetFromErrno(SelectError);
>    }
>    else if (n == 0) {

Well, I'd agree it's not good style - therefore it deserves a comment
<wink>.  I'd say with a reasonable comment you should just go for it.

BDFL-pronouncement-not-withstanding ly,

Mark.