summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-11-06 21:34:58 (GMT)
committerGuido van Rossum <guido@python.org>2007-11-06 21:34:58 (GMT)
commit98297ee7815939b124156e438b22bd652d67b5db (patch)
treea9d239ebd87c73af2571ab48003984c4e18e27e5 /Objects/codeobject.c
parenta19f80c6df2df5e8a5d0cff37131097835ef971e (diff)
downloadcpython-98297ee7815939b124156e438b22bd652d67b5db.zip
cpython-98297ee7815939b124156e438b22bd652d67b5db.tar.gz
cpython-98297ee7815939b124156e438b22bd652d67b5db.tar.bz2
Merging the py3k-pep3137 branch back into the py3k branch.
No detailed change log; just check out the change log for the py3k-pep3137 branch. The most obvious changes: - str8 renamed to bytes (PyString at the C level); - bytes renamed to buffer (PyBytes at the C level); - PyString and PyUnicode are no longer compatible. I.e. we now have an immutable bytes type and a mutable bytes type. The behavior of PyString was modified quite a bit, to make it more bytes-like. Some changes are still on the to-do list.
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index b9a26ba..80c2df9 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -8,7 +8,7 @@
/* all_name_chars(s): true iff all chars in s are valid NAME_CHARS */
static int
-all_name_chars(unsigned char *s)
+all_name_chars(Py_UNICODE *s)
{
static char ok_name_char[256];
static unsigned char *name_chars = (unsigned char *)NAME_CHARS;
@@ -19,6 +19,8 @@ all_name_chars(unsigned char *s)
ok_name_char[*p] = 1;
}
while (*s) {
+ if (*s >= 128)
+ return 0;
if (ok_name_char[*s++] == 0)
return 0;
}
@@ -73,11 +75,11 @@ PyCode_New(int argcount, int kwonlyargcount,
/* Intern selected string constants */
for (i = PyTuple_Size(consts); --i >= 0; ) {
PyObject *v = PyTuple_GetItem(consts, i);
- if (!PyString_Check(v))
+ if (!PyUnicode_Check(v))
continue;
- if (!all_name_chars((unsigned char *)PyString_AS_STRING(v)))
+ if (!all_name_chars(PyUnicode_AS_UNICODE(v)))
continue;
- PyString_InternInPlace(&PyTuple_GET_ITEM(consts, i));
+ PyUnicode_InternInPlace(&PyTuple_GET_ITEM(consts, i));
}
co = PyObject_NEW(PyCodeObject, &PyCode_Type);
if (co != NULL) {
@@ -202,7 +204,7 @@ code_new(PyTypeObject *type, PyObject *args, PyObject *kw)
int firstlineno;
PyObject *lnotab;
- if (!PyArg_ParseTuple(args, "iiiiiSO!O!O!SSiS|O!O!:code",
+ if (!PyArg_ParseTuple(args, "iiiiiSO!O!O!UUiS|O!O!:code",
&argcount, &kwonlyargcount,
&nlocals, &stacksize, &flags,
&code,