From: Benjamin Peterson Date: Wed, 2 Jan 2013 05:04:16 +0000 (-0600) Subject: get the core to compile --disable-unicode X-Git-Tag: v2.7.4rc1~164^2~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ca88d2b181fe42ced2f590f2a4115b48860240d;p=python get the core to compile --disable-unicode --- diff --git a/Modules/sre.h b/Modules/sre.h index 9bfdf7fdfc..cbc98f1a13 100644 --- a/Modules/sre.h +++ b/Modules/sre.h @@ -15,7 +15,11 @@ /* size of a code word (must be unsigned short or larger, and large enough to hold a UCS4 character) */ +#ifdef Py_USING_UNICODE #define SRE_CODE Py_UCS4 +#else +#define SRE_CODE unsigned long +#endif typedef struct { PyObject_VAR_HEAD diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 561ec217c2..ece23703d4 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -1816,7 +1816,6 @@ file_write(PyFileObject *f, PyObject *args) n = pbuf.len; } else { - const char *encoding, *errors; PyObject *text; if (!PyArg_ParseTuple(args, "O", &text)) return NULL; @@ -1824,7 +1823,9 @@ file_write(PyFileObject *f, PyObject *args) if (PyString_Check(text)) { s = PyString_AS_STRING(text); n = PyString_GET_SIZE(text); +#ifdef Py_USING_UNICODE } else if (PyUnicode_Check(text)) { + const char *encoding, *errors; if (f->f_encoding != Py_None) encoding = PyString_AS_STRING(f->f_encoding); else @@ -1838,6 +1839,7 @@ file_write(PyFileObject *f, PyObject *args) return NULL; s = PyString_AS_STRING(encoded); n = PyString_GET_SIZE(encoded); +#endif } else { if (PyObject_AsCharBuffer(text, &s, &n)) return NULL;