diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-08-17 18:39:25 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-08-17 18:39:25 (GMT) |
commit | 339d0f720e86dc34837547c90d3003a4a68d7d46 (patch) | |
tree | 2059e5d02f490540e759800b127d50f3fcd8c2b5 /Objects/abstract.c | |
parent | f75976617bb36c892ee8a0f6a6fd3caddbd38cea (diff) | |
download | cpython-339d0f720e86dc34837547c90d3003a4a68d7d46.zip cpython-339d0f720e86dc34837547c90d3003a4a68d7d46.tar.gz cpython-339d0f720e86dc34837547c90d3003a4a68d7d46.tar.bz2 |
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.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index b646c36..f7ade6d 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -583,8 +583,10 @@ PyNumber_Remainder(PyObject *v, PyObject *w) { if (PyString_Check(v)) return PyString_Format(v, w); +#ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) return PyUnicode_Format(v, w); +#endif return binary_op(v, w, NB_SLOT(nb_remainder), "%"); } @@ -707,8 +709,10 @@ PyNumber_InPlaceRemainder(PyObject *v, PyObject *w) { if (PyString_Check(v)) return PyString_Format(v, w); +#ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) return PyUnicode_Format(v, w); +#endif else return binary_iop(v, w, NB_SLOT(nb_inplace_remainder), NB_SLOT(nb_remainder), "%="); @@ -821,10 +825,12 @@ PyNumber_Int(PyObject *o) if (PyString_Check(o)) return int_from_string(PyString_AS_STRING(o), PyString_GET_SIZE(o)); +#ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(o), PyUnicode_GET_SIZE(o), 10); +#endif m = o->ob_type->tp_as_number; if (m && m->nb_int) return m->nb_int(o); @@ -873,11 +879,13 @@ PyNumber_Long(PyObject *o) */ return long_from_string(PyString_AS_STRING(o), PyString_GET_SIZE(o)); +#ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) /* The above check is done in PyLong_FromUnicode(). */ return PyLong_FromUnicode(PyUnicode_AS_UNICODE(o), PyUnicode_GET_SIZE(o), 10); +#endif m = o->ob_type->tp_as_number; if (m && m->nb_long) return m->nb_long(o); |