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/Objects/longobject.c b/Objects/longobject.c
index 9f7272c..01a7276 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -971,6 +971,7 @@
return NULL;
}
+#ifdef Py_USING_UNICODE
PyObject *
PyLong_FromUnicode(Py_UNICODE *u, int length, int base)
{
@@ -986,6 +987,7 @@
return PyLong_FromString(buffer, NULL, base);
}
+#endif
/* forward */
static PyLongObject *x_divrem
@@ -2054,10 +2056,12 @@
return PyNumber_Long(x);
else if (PyString_Check(x))
return PyLong_FromString(PyString_AS_STRING(x), NULL, base);
+#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(x))
return PyLong_FromUnicode(PyUnicode_AS_UNICODE(x),
PyUnicode_GET_SIZE(x),
base);
+#endif
else {
PyErr_SetString(PyExc_TypeError,
"long() can't convert non-string with explicit base");