Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 11825:4080c7a0f1ed legacy-trunk
Mark pointed out a buglet in his patch: i < _sys_nerr isn't strong
enough, it could be negative. Add i > 0 test. (Not i >= 0; zero isn't
a valid error number.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 21 Feb 2000 16:50:31 +0000 |
| parents | fe960ad3db65 |
| children | 723efcdcce1b |
comparison
equal
deleted
inserted
replaced
| 11824:7c255e7a21c2 | 11825:4080c7a0f1ed |
|---|---|
| 306 /* Note that the Win32 errors do not lineup with the | 306 /* Note that the Win32 errors do not lineup with the |
| 307 errno error. So if the error is in the MSVC error | 307 errno error. So if the error is in the MSVC error |
| 308 table, we use it, otherwise we assume it really _is_ | 308 table, we use it, otherwise we assume it really _is_ |
| 309 a Win32 error code | 309 a Win32 error code |
| 310 */ | 310 */ |
| 311 if (i < _sys_nerr) { | 311 if (i > 0 && i < _sys_nerr) { |
| 312 s = _sys_errlist[i]; | 312 s = _sys_errlist[i]; |
| 313 } | 313 } |
| 314 else { | 314 else { |
| 315 int len = FormatMessage( | 315 int len = FormatMessage( |
| 316 FORMAT_MESSAGE_ALLOCATE_BUFFER | | 316 FORMAT_MESSAGE_ALLOCATE_BUFFER | |
