[Python-checkins] cpython (2.7): get the core to compile --disable-unicode

benjamin.peterson python-checkins at python.org
Wed Jan 2 06:04:28 CET 2013


http://hg.python.org/cpython/rev/f6e74759d740
changeset:   81218:f6e74759d740
branch:      2.7
parent:      81201:de82da4b04cd
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Jan 01 23:04:16 2013 -0600
summary:
  get the core to compile --disable-unicode

files:
  Modules/sre.h        |  4 ++++
  Objects/fileobject.c |  4 +++-
  2 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Modules/sre.h b/Modules/sre.h
--- 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
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -1816,7 +1816,6 @@
         n = pbuf.len;
     }
     else {
-        const char *encoding, *errors;
         PyObject *text;
         if (!PyArg_ParseTuple(args, "O", &text))
             return NULL;
@@ -1824,7 +1823,9 @@
         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 @@
                 return NULL;
             s = PyString_AS_STRING(encoded);
             n = PyString_GET_SIZE(encoded);
+#endif
         } else {
             if (PyObject_AsCharBuffer(text, &s, &n))
                 return NULL;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list