From: Guido van Rossum <guido@python.org>
Date: Mon, 21 Feb 2000 16:50:31 +0000 (+0000)
Subject: Mark pointed out a buglet in his patch: i < _sys_nerr isn't strong
X-Git-Tag: v1.6a1~381
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=584b16a1f340b086526773ec3275589468ae4b04;p=python

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.)
---

diff --git a/Python/errors.c b/Python/errors.c
index 71e51c3023..b3e1910789 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -308,7 +308,7 @@ PyErr_SetFromErrnoWithFilename(exc, filename)
 		   table, we use it, otherwise we assume it really _is_ 
 		   a Win32 error code
 		*/
-		if (i < _sys_nerr) {
+		if (i > 0 && i < _sys_nerr) {
 			s = _sys_errlist[i];
 		}
 		else {