diff options
author | Guido van Rossum <guido@python.org> | 2007-04-27 23:53:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-04-27 23:53:51 (GMT) |
commit | 572dbf8f1320c0b34b9c786e5c30ba4a4b61b292 (patch) | |
tree | 27763a28b40b577302161008a00539649e2a536d /Python | |
parent | d4617f24caa1827106f5ca5e74655adf919ea499 (diff) | |
download | cpython-572dbf8f1320c0b34b9c786e5c30ba4a4b61b292.zip cpython-572dbf8f1320c0b34b9c786e5c30ba4a4b61b292.tar.gz cpython-572dbf8f1320c0b34b9c786e5c30ba4a4b61b292.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 2 | ||||
-rw-r--r-- | Python/bltinmodule.c | 4 | ||||
-rw-r--r-- | Python/ceval.c | 2 | ||||
-rw-r--r-- | Python/getargs.c | 4 | ||||
-rw-r--r-- | Python/import.c | 2 | ||||
-rw-r--r-- | Python/pythonrun.c | 1 |
6 files changed, 7 insertions, 8 deletions
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 @@ parsestr(const node *n, const char *encoding, int *bytesmode) } } #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 @@ static PyMethodDef builtin_methods[] = { {"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 @@ _PyBuiltin_Init(void) 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 @@ PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, 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 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, 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 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format, 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 @@ _PyImport_Init(void) } } - 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_InspectFlag; /* Needed to determine whether to exit at SystemError */ 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 |