[issue20049] string.lowercase and string.uppercase can contain garbage

Antoine Pitrou report at bugs.python.org
Sun Dec 22 15:48:53 CET 2013


Antoine Pitrou added the comment:

To elaborate yet a bit, I agree with the following statement in the aforementioned [illumos-devel] discussion thread:

"""In further explanation, the isalpha() and friends *should* probably return false for the value 196, or any other byte with high order bit set, in UTF-8 locales."""
http://thread.gmane.org/gmane.os.illumos.devel/14193/focus=14206

I'll also point out that the code examples in the POSIX spec use islower() exactly like Python does (on arbitrary integers) between 0 and 255:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/islower.html

    c = (unsigned char) (rand() % 256);
...
    if (islower(c))
        keystr[len++] = c;
    }
...

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20049>
_______________________________________


More information about the Python-bugs-list mailing list