Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 22205:f4487350c537 legacy-trunk
Patch #494045: patches errno and stat to cope on plan9.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Sat, 09 Mar 2002 12:07:51 +0000 |
| parents | d4406fbfcb4e |
| children | 8291473fde3e |
comparison
equal
deleted
inserted
replaced
| 22204:928c1282e5e2 | 22205:f4487350c537 |
|---|---|
| 262 PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) | 262 PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) |
| 263 { | 263 { |
| 264 PyObject *v; | 264 PyObject *v; |
| 265 char *s; | 265 char *s; |
| 266 int i = errno; | 266 int i = errno; |
| 267 #ifdef PLAN9 | |
| 268 char errbuf[ERRMAX]; | |
| 269 #endif | |
| 267 #ifdef MS_WIN32 | 270 #ifdef MS_WIN32 |
| 268 char *s_buf = NULL; | 271 char *s_buf = NULL; |
| 269 #endif | 272 #endif |
| 270 #ifdef EINTR | 273 #ifdef EINTR |
| 271 if (i == EINTR && PyErr_CheckSignals()) | 274 if (i == EINTR && PyErr_CheckSignals()) |
| 272 return NULL; | 275 return NULL; |
| 273 #endif | 276 #endif |
| 277 #ifdef PLAN9 | |
| 278 rerrstr(errbuf, sizeof errbuf); | |
| 279 s = errbuf; | |
| 280 #else | |
| 274 if (i == 0) | 281 if (i == 0) |
| 275 s = "Error"; /* Sometimes errno didn't get set */ | 282 s = "Error"; /* Sometimes errno didn't get set */ |
| 276 else | 283 else |
| 277 #ifndef MS_WIN32 | 284 #ifndef MS_WIN32 |
| 278 s = strerror(i); | 285 s = strerror(i); |
| 303 /* remove trailing cr/lf and dots */ | 310 /* remove trailing cr/lf and dots */ |
| 304 while (len > 0 && (s[len-1] <= ' ' || s[len-1] == '.')) | 311 while (len > 0 && (s[len-1] <= ' ' || s[len-1] == '.')) |
| 305 s[--len] = '\0'; | 312 s[--len] = '\0'; |
| 306 } | 313 } |
| 307 } | 314 } |
| 308 #endif | 315 #endif /* Unix/Windows */ |
| 316 #endif /* PLAN 9*/ | |
| 309 if (filename != NULL) | 317 if (filename != NULL) |
| 310 v = Py_BuildValue("(iss)", i, s, filename); | 318 v = Py_BuildValue("(iss)", i, s, filename); |
| 311 else | 319 else |
| 312 v = Py_BuildValue("(is)", i, s); | 320 v = Py_BuildValue("(is)", i, s); |
| 313 if (v != NULL) { | 321 if (v != NULL) { |
