summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-04 15:21:25 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-04 15:21:25 (GMT)
commite81b0d335b13bc1f26a08b292807ac17c8670b1c (patch)
tree2cbe866587ea5a3ff86501efc7ae29f2234e5ae5 /Objects
parent804480912c8328df7d042c6e5201cfe4abf21742 (diff)
parent09f3d080fe0cadab0db6380c58dd4968db20287d (diff)
downloadcpython-e81b0d335b13bc1f26a08b292807ac17c8670b1c.zip
cpython-e81b0d335b13bc1f26a08b292807ac17c8670b1c.tar.gz
cpython-e81b0d335b13bc1f26a08b292807ac17c8670b1c.tar.bz2
Issue #28350: String constants with null character no longer interned.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/codeobject.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index fdd357e..b6e5bd3 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -19,21 +19,21 @@ static int
all_name_chars(PyObject *o)
{
static char ok_name_char[256];
- static unsigned char *name_chars = (unsigned char *)NAME_CHARS;
- PyUnicodeObject *u = (PyUnicodeObject *)o;
- const unsigned char *s;
+ static const unsigned char *name_chars = (unsigned char *)NAME_CHARS;
+ const unsigned char *s, *e;
- if (!PyUnicode_Check(o) || PyUnicode_READY(u) == -1 ||
- PyUnicode_MAX_CHAR_VALUE(u) >= 128)
+ if (!PyUnicode_Check(o) || PyUnicode_READY(o) == -1 ||
+ !PyUnicode_IS_ASCII(o))
return 0;
if (ok_name_char[*name_chars] == 0) {
- unsigned char *p;
+ const unsigned char *p;
for (p = name_chars; *p; p++)
ok_name_char[*p] = 1;
}
- s = PyUnicode_1BYTE_DATA(u);
- while (*s) {
+ s = PyUnicode_1BYTE_DATA(o);
+ e = s + PyUnicode_GET_LENGTH(o);
+ while (s != e) {
if (ok_name_char[*s++] == 0)
return 0;
}