Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 4bddc46..3311093 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -28,6 +28,11 @@
 #define Py_TPFLAGS_GC 0
 #endif
 
+#if (PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION > 5) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 2)
+/* In Python 1.6, 2.0 and  2.1, disabling Unicode was not possible. */
+#define Py_USING_UNICODE
+#endif
+
 enum HandlerTypes {
     StartElement,
     EndElement,
@@ -173,7 +178,7 @@
 }
 #endif
 
-#if !(PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6)
+#ifdef Py_USING_UNICODE
 #if EXPAT_VERSION == 0x010200
 static PyObject *
 conv_atts_using_unicode(XML_Char **atts)
@@ -370,7 +375,7 @@
     return res;
 }
 
-#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
+#ifndef Py_USING_UNICODE
 #define STRING_CONV_FUNC conv_string_to_utf8
 #else
 /* Python 1.6 and later versions */
@@ -506,7 +511,7 @@
               const XML_Char *data),
              ("(O&O&)",STRING_CONV_FUNC,target, STRING_CONV_FUNC,data))
 
-#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
+#ifndef Py_USING_UNICODE
 VOID_HANDLER(CharacterData, 
              (void *userData, const XML_Char *data, int len), 
              ("(N)", conv_string_len_to_utf8(data,len)))
@@ -531,7 +536,7 @@
               STRING_CONV_FUNC,notationName))
 
 #if EXPAT_VERSION >= 0x015f00
-#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
+#ifndef Py_USING_UNICODE
 VOID_HANDLER(EntityDecl,
              (void *userData,
               const XML_Char *entityName,
@@ -608,7 +613,7 @@
     return conv_content_model(model, conv_string_to_utf8);
 }
 
-#if !(PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6)
+#ifdef Py_USING_UNICODE
 static PyObject *
 conv_content_model_unicode(XML_Content * const model)
 {
@@ -678,7 +683,7 @@
                (void *userData),
 		("()"))
 
-#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
+#ifndef Py_USING_UNICODE
 VOID_HANDLER(Default,
 	      (void *userData,  const XML_Char *s, int len),
 	      ("(N)", conv_string_len_to_utf8(s,len)))
@@ -1064,7 +1069,7 @@
 /* ---------- */
 
 
-#if !(PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6)
+#ifdef Py_USING_UNICODE
 
 /* 
     pyexpat international encoding support.
@@ -1158,8 +1163,7 @@
         return NULL;
     }
     XML_SetUserData(self->itself, (void *)self);
-#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
-#else
+#ifdef Py_USING_UNICODE
     XML_SetUnknownEncodingHandler(self->itself, (XML_UnknownEncodingHandler) PyUnknownEncodingHandler, NULL);
 #endif
 
@@ -1292,7 +1296,7 @@
     }
     if (strcmp(name, "returns_unicode") == 0) {
         if (PyObject_IsTrue(v)) {
-#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
+#ifndef Py_USING_UNICODE
             PyErr_SetString(PyExc_ValueError, 
                             "Cannot return Unicode strings in Python 1.5");
             return -1;
@@ -1545,8 +1549,7 @@
                                          info.minor, info.micro));
     }
 #endif
-#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
-#else
+#ifdef Py_USING_UNICODE
     init_template_buffer();
 #endif
     /* XXX When Expat supports some way of figuring out how it was