comparison Python/errors.c @ 59029:3357b8ebb259

Poor PLAN9, it isn't supported
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 22 Feb 2010 19:41:37 +0000
parents c1972eef3579
children 07a47a514548
comparison
equal deleted inserted replaced
59027:5c4466b16d6d 59029:3357b8ebb259
358 PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) 358 PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject)
359 { 359 {
360 PyObject *message; 360 PyObject *message;
361 PyObject *v; 361 PyObject *v;
362 int i = errno; 362 int i = errno;
363 #ifdef PLAN9
364 char errbuf[ERRMAX];
365 #else
366 #ifndef MS_WINDOWS 363 #ifndef MS_WINDOWS
367 char *s; 364 char *s;
368 #else 365 #else
369 WCHAR *s_buf = NULL; 366 WCHAR *s_buf = NULL;
370 #endif /* Unix/Windows */ 367 #endif /* Unix/Windows */
371 #endif /* PLAN 9*/
372 368
373 #ifdef EINTR 369 #ifdef EINTR
374 if (i == EINTR && PyErr_CheckSignals()) 370 if (i == EINTR && PyErr_CheckSignals())
375 return NULL; 371 return NULL;
376 #endif 372 #endif
377 373
378 #ifdef PLAN9
379 rerrstr(errbuf, sizeof errbuf);
380 message = PyUnicode_DecodeUTF8(errbuf, strlen(errbuf), "ignore");
381 #else
382 #ifndef MS_WINDOWS 374 #ifndef MS_WINDOWS
383 if (i == 0) 375 if (i == 0)
384 s = "Error"; /* Sometimes errno didn't get set */ 376 s = "Error"; /* Sometimes errno didn't get set */
385 else 377 else
386 s = strerror(i); 378 s = strerror(i);
423 message = PyUnicode_FromUnicode(s_buf, len); 415 message = PyUnicode_FromUnicode(s_buf, len);
424 } 416 }
425 } 417 }
426 } 418 }
427 #endif /* Unix/Windows */ 419 #endif /* Unix/Windows */
428 #endif /* PLAN 9*/
429 420
430 if (message == NULL) 421 if (message == NULL)
431 { 422 {
432 #ifdef MS_WINDOWS 423 #ifdef MS_WINDOWS
433 LocalFree(s_buf); 424 LocalFree(s_buf);