Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 72475:8beaa9a37387
Implement PEP 393.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 28 Sep 2011 07:41:54 +0200 |
| parents | 3c9232a684ae |
| children | 81380082d216 |
comparison
equal
deleted
inserted
replaced
| 72474:1726fa560112 | 72475:8beaa9a37387 |
|---|---|
| 393 message = PyUnicode_FromFormat("Windows Error 0x%X", i); | 393 message = PyUnicode_FromFormat("Windows Error 0x%X", i); |
| 394 } else { | 394 } else { |
| 395 /* remove trailing cr/lf and dots */ | 395 /* remove trailing cr/lf and dots */ |
| 396 while (len > 0 && (s_buf[len-1] <= L' ' || s_buf[len-1] == L'.')) | 396 while (len > 0 && (s_buf[len-1] <= L' ' || s_buf[len-1] == L'.')) |
| 397 s_buf[--len] = L'\0'; | 397 s_buf[--len] = L'\0'; |
| 398 message = PyUnicode_FromUnicode(s_buf, len); | 398 message = PyUnicode_FromWideChar(s_buf, len); |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 #endif /* Unix/Windows */ | 402 #endif /* Unix/Windows */ |
| 403 | 403 |
| 485 s_buf = NULL; | 485 s_buf = NULL; |
| 486 } else { | 486 } else { |
| 487 /* remove trailing cr/lf and dots */ | 487 /* remove trailing cr/lf and dots */ |
| 488 while (len > 0 && (s_buf[len-1] <= L' ' || s_buf[len-1] == L'.')) | 488 while (len > 0 && (s_buf[len-1] <= L' ' || s_buf[len-1] == L'.')) |
| 489 s_buf[--len] = L'\0'; | 489 s_buf[--len] = L'\0'; |
| 490 message = PyUnicode_FromUnicode(s_buf, len); | 490 message = PyUnicode_FromWideChar(s_buf, len); |
| 491 } | 491 } |
| 492 | 492 |
| 493 if (message == NULL) | 493 if (message == NULL) |
| 494 { | 494 { |
| 495 LocalFree(s_buf); | 495 LocalFree(s_buf); |
