[Python-Dev] Assign to errno allowed? (original) (raw)
Thomas Heller thomas.heller@ion-tof.com
Tue, 24 Sep 2002 15:24:41 +0200
- Previous message: [Python-Dev] bug 576990
- Next message: [Python-Dev] Assign to errno allowed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm trying to fix selectmodule.c on Windows (it raises bogus exceptions, because select() on Windows does not set errno). The first patch I had was this:
if (n < 0) {
- #ifdef MS_WINDOWS
- PyErr_SetExcFromWindowsErr(SelectError, WSAGetLastError());
- #else PyErr_SetFromErrno(SelectError);
- #endif } else if (n == 0) { /* optimization */
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) {
Thomas
- Previous message: [Python-Dev] bug 576990
- Next message: [Python-Dev] Assign to errno allowed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]