mirror of https://github.com/python/cpython.git
valid_identifier(): use an unsigned char* so that isalpha() will do
the right thing even if char is unsigned.
This commit is contained in:
parent
c0e35158fb
commit
03013a0130
|
@ -962,7 +962,7 @@ static PyObject *bozo_obj = NULL;
|
||||||
static int
|
static int
|
||||||
valid_identifier(PyObject *s)
|
valid_identifier(PyObject *s)
|
||||||
{
|
{
|
||||||
char *p;
|
unsigned char *p;
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
if (!PyString_Check(s)) {
|
if (!PyString_Check(s)) {
|
||||||
|
@ -970,7 +970,7 @@ valid_identifier(PyObject *s)
|
||||||
"__slots__ must be strings");
|
"__slots__ must be strings");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
p = PyString_AS_STRING(s);
|
p = (unsigned char *) PyString_AS_STRING(s);
|
||||||
n = PyString_GET_SIZE(s);
|
n = PyString_GET_SIZE(s);
|
||||||
/* We must reject an empty name. As a hack, we bump the
|
/* 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. */
|
length to 1 so that the loop will balk on the trailing \0. */
|
||||||
|
|
Loading…
Reference in New Issue