]> granicus.if.org Git - python/commitdiff
valid_identifier(): use an unsigned char* so that isalpha() will do
authorGuido van Rossum <guido@python.org>
Tue, 16 Jul 2002 14:30:28 +0000 (14:30 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 16 Jul 2002 14:30:28 +0000 (14:30 +0000)
the right thing even if char is unsigned.

Objects/typeobject.c

index a7afa9b7f0cc30d9a03f7cd5e6abb1b961d08c35..a7263d8e7723f8f0582d1271d043babe6c61e1a5 100644 (file)
@@ -962,7 +962,7 @@ static PyObject *bozo_obj = NULL;
 static int
 valid_identifier(PyObject *s)
 {
-       char *p;
+       unsigned char *p;
        int i, n;
 
        if (!PyString_Check(s)) {
@@ -970,7 +970,7 @@ valid_identifier(PyObject *s)
                                "__slots__ must be strings");
                return 0;
        }
-       p = PyString_AS_STRING(s);
+       p = (unsigned char *) PyString_AS_STRING(s);
        n = PyString_GET_SIZE(s);
        /* We must reject an empty name.  As a hack, we bump the
           length to 1 so that the loop will balk on the trailing \0. */