[Patches] win32 module case bugfix to allcaps83

Guido van Rossum guido@python.org
Mon, 01 May 2000 13:26:15 -0400


> The following patch seems to fix a module case bug in 1.6a2 caused
> by wrong return values in routine allcaps83 in import.c

Bizarre...  This code must not have been exercised much.  I'm sure
that Mark Hammond didn't mind it returning 1 for too many cases. :-)

> *** import.c.orig       Sat Apr 29 09:12:18 2000
> --- import.c    Sat Apr 29 09:14:34 2000
> ***************
> *** 1035,1046 ****
>         char *end = strchr(s, '\0');
>         if (dot != NULL) {
>                 if (dot-s > 8)
> !                       return 1; /* More than 8 before '.' */
>                 if (end-dot > 4)
> !                       return 1; /* More than 3 after '.' */
>                 end = strchr(dot+1, '.');
>                 if (end != NULL)
> !                       return 1; /* More than one dot  */
>         }
>         else if (end-s > 8)
>                 return 1; /* More than 8 and no dot */
> --- 1035,1046 ----
>         char *end = strchr(s, '\0');
>         if (dot != NULL) {
>                 if (dot-s > 8)
> !                       return 0; /* More than 8 before '.' */
>                 if (end-dot > 4)
> !                       return 0; /* More than 3 after '.' */
>                 end = strchr(dot+1, '.');
>                 if (end != NULL)
> !                       return 0; /* More than one dot  */
>         }
>         else if (end-s > 8)
>                 return 1; /* More than 8 and no dot */

I would think that this case should also return 0!

I'll check this in with the above addition.

--Guido van Rossum (home page: http://www.python.org/~guido/)