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 /Modules/cPickle.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 'Modules/cPickle.c')
-rw-r--r-- | Modules/cPickle.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c index b27339f..bb0d281 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -1172,6 +1172,7 @@ err: } +#ifdef Py_USING_UNICODE /* A copy of PyUnicode_EncodeRawUnicodeEscape() that also translates backslash and newline characters to \uXXXX escapes. */ static PyObject * @@ -1289,6 +1290,7 @@ err: Py_XDECREF(repr); return -1; } +#endif static int @@ -1824,11 +1826,13 @@ save(Picklerobject *self, PyObject *args, int pers_save) { goto finally; } +#ifdef Py_USING_UNICODE case 'u': if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { res = save_unicode(self, args, 0); goto finally; } +#endif } if (args->ob_refcnt > 1) { @@ -1857,12 +1861,14 @@ save(Picklerobject *self, PyObject *args, int pers_save) { } break; +#ifdef Py_USING_UNICODE case 'u': if (type == &PyUnicode_Type) { res = save_unicode(self, args, 1); goto finally; } break; +#endif case 't': if (type == &PyTuple_Type) { @@ -2818,6 +2824,7 @@ load_short_binstring(Unpicklerobject *self) { } +#ifdef Py_USING_UNICODE static int load_unicode(Unpicklerobject *self) { PyObject *str = 0; @@ -2836,8 +2843,10 @@ load_unicode(Unpicklerobject *self) { finally: return res; } +#endif +#ifdef Py_USING_UNICODE static int load_binunicode(Unpicklerobject *self) { PyObject *unicode; @@ -2857,6 +2866,7 @@ load_binunicode(Unpicklerobject *self) { PDATA_PUSH(self->stack, unicode, -1); return 0; } +#endif static int @@ -3615,6 +3625,7 @@ load(Unpicklerobject *self) { break; continue; +#ifdef Py_USING_UNICODE case UNICODE: if (load_unicode(self) < 0) break; @@ -3624,6 +3635,7 @@ load(Unpicklerobject *self) { if (load_binunicode(self) < 0) break; continue; +#endif case EMPTY_TUPLE: if (load_empty_tuple(self) < 0) @@ -3905,6 +3917,7 @@ noload(Unpicklerobject *self) { break; continue; +#ifdef Py_USING_UNICODE case UNICODE: if (load_unicode(self) < 0) break; @@ -3914,6 +3927,7 @@ noload(Unpicklerobject *self) { if (load_binunicode(self) < 0) break; continue; +#endif case EMPTY_TUPLE: if (load_empty_tuple(self) < 0) |