comparison Python/errors.c @ 24071:8142f8d668a0 legacy-trunk

Patch #569753: Remove support for WIN16. Rename all occurrences of MS_WIN32 to MS_WINDOWS.
author Martin v. Löwis <martin@v.loewis.de>
date Sun, 30 Jun 2002 15:26:10 +0000
parents 8291473fde3e
children 3db261a93a5b
comparison
equal deleted inserted replaced
24070:b128255c2bea 24071:8142f8d668a0
13 #ifndef MS_WINDOWS 13 #ifndef MS_WINDOWS
14 extern char *strerror(int); 14 extern char *strerror(int);
15 #endif 15 #endif
16 #endif 16 #endif
17 17
18 #ifdef MS_WIN32 18 #ifdef MS_WINDOWS
19 #include "windows.h" 19 #include "windows.h"
20 #include "winbase.h" 20 #include "winbase.h"
21 #endif 21 #endif
22 22
23 #include <ctype.h> 23 #include <ctype.h>
265 char *s; 265 char *s;
266 int i = errno; 266 int i = errno;
267 #ifdef PLAN9 267 #ifdef PLAN9
268 char errbuf[ERRMAX]; 268 char errbuf[ERRMAX];
269 #endif 269 #endif
270 #ifdef MS_WIN32 270 #ifdef MS_WINDOWS
271 char *s_buf = NULL; 271 char *s_buf = NULL;
272 #endif 272 #endif
273 #ifdef EINTR 273 #ifdef EINTR
274 if (i == EINTR && PyErr_CheckSignals()) 274 if (i == EINTR && PyErr_CheckSignals())
275 return NULL; 275 return NULL;
279 s = errbuf; 279 s = errbuf;
280 #else 280 #else
281 if (i == 0) 281 if (i == 0)
282 s = "Error"; /* Sometimes errno didn't get set */ 282 s = "Error"; /* Sometimes errno didn't get set */
283 else 283 else
284 #ifndef MS_WIN32 284 #ifndef MS_WINDOWS
285 s = strerror(i); 285 s = strerror(i);
286 #else 286 #else
287 { 287 {
288 /* Note that the Win32 errors do not lineup with the 288 /* Note that the Win32 errors do not lineup with the
289 errno error. So if the error is in the MSVC error 289 errno error. So if the error is in the MSVC error
320 v = Py_BuildValue("(is)", i, s); 320 v = Py_BuildValue("(is)", i, s);
321 if (v != NULL) { 321 if (v != NULL) {
322 PyErr_SetObject(exc, v); 322 PyErr_SetObject(exc, v);
323 Py_DECREF(v); 323 Py_DECREF(v);
324 } 324 }
325 #ifdef MS_WIN32 325 #ifdef MS_WINDOWS
326 LocalFree(s_buf); 326 LocalFree(s_buf);
327 #endif 327 #endif
328 return NULL; 328 return NULL;
329 } 329 }
330 330