Checkpoint. Manipulated things so that string literals are always
unicode, and a few other compensating changes, e.g. str <- unicode,
chr <- unichr, and repr() of a unicode string no longer starts
with 'u'. Lots of unit tests are broken, but some basic things
work, in particular distutils works so the extensions can be built,
and test_builtin.py works.
diff --git a/Python/ast.c b/Python/ast.c
index 8b91894..d7e3b36 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -3187,7 +3187,7 @@
}
}
#ifdef Py_USING_UNICODE
- if (unicode || Py_UnicodeFlag) {
+ if (!*bytesmode) {
return decode_unicode(s, len, rawmode, encoding);
}
#endif
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 17cdb92..fef001d 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2270,7 +2270,7 @@
{"all", builtin_all, METH_O, all_doc},
{"any", builtin_any, METH_O, any_doc},
{"callable", builtin_callable, METH_O, callable_doc},
- {"chr", builtin_chr, METH_VARARGS, chr_doc},
+ {"chr", builtin_unichr, METH_VARARGS, chr_doc},
{"cmp", builtin_cmp, METH_VARARGS, cmp_doc},
{"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc},
{"delattr", builtin_delattr, METH_VARARGS, delattr_doc},
@@ -2375,7 +2375,7 @@
SETBUILTIN("set", &PySet_Type);
SETBUILTIN("slice", &PySlice_Type);
SETBUILTIN("staticmethod", &PyStaticMethod_Type);
- SETBUILTIN("str", &PyString_Type);
+ SETBUILTIN("str", &PyUnicode_Type);
SETBUILTIN("super", &PySuper_Type);
SETBUILTIN("tuple", &PyTuple_Type);
SETBUILTIN("type", &PyType_Type);
diff --git a/Python/ceval.c b/Python/ceval.c
index fdee13d..00fc050 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2633,7 +2633,7 @@
PyObject *keyword = kws[2*i];
PyObject *value = kws[2*i + 1];
int j;
- if (keyword == NULL || !PyString_Check(keyword)) {
+ if (keyword == NULL || !(PyString_Check(keyword) || PyUnicode_Check(keyword))) {
PyErr_Format(PyExc_TypeError,
"%.200s() keywords must be strings",
PyString_AsString(co->co_name));
diff --git a/Python/getargs.c b/Python/getargs.c
index 91d9b47..3b58c98 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1081,7 +1081,7 @@
case 'S': { /* string object */
PyObject **p = va_arg(*p_va, PyObject **);
- if (PyString_Check(arg))
+ if (PyString_Check(arg) || PyUnicode_Check(arg))
*p = arg;
else
return converterr("string", arg, msgbuf, bufsize);
@@ -1531,7 +1531,7 @@
while (PyDict_Next(keywords, &pos, &key, &value)) {
int match = 0;
char *ks;
- if (!PyString_Check(key)) {
+ if (!PyString_Check(key) && !PyUnicode_Check(key)) {
PyErr_SetString(PyExc_TypeError,
"keywords must be strings");
return cleanreturn(0, freelist);
diff --git a/Python/import.c b/Python/import.c
index 2350800..6d742b9 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -154,7 +154,7 @@
}
}
- if (Py_UnicodeFlag) {
+ {
/* Fix the pyc_magic so that byte compiled code created
using the all-Unicode method doesn't interfere with
code created in normal operation mode. */
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 8ff3629..3d16ba5 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -76,7 +76,6 @@
int Py_NoSiteFlag; /* Suppress 'import site' */
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
int Py_FrozenFlag; /* Needed by getpath.c */
-int Py_UnicodeFlag = 0; /* Needed by compile.c */
int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
/* Reference to 'warnings' module, to avoid importing it