diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2002-08-07 12:33:18 +0000 |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2002-08-07 12:33:18 +0000 |
| commit | 03d47d1f1c6e96fbe46d70e109e7a25308710959 (patch) | |
| tree | e131d3caab4d3a3f8eb9f9ba17562326dc796d14 /Python/compile.c | |
| parent | 368ab9275e57d34054460d7db51d20d56b5eb07a (diff) | |
| download | cpython-03d47d1f1c6e96fbe46d70e109e7a25308710959.tar.gz | |
Fix PEP 263 code --without-unicode. Fixes #591943.
Diffstat (limited to 'Python/compile.c')
| -rw-r--r-- | Python/compile.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index 512b5a339d..b67193773c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1185,6 +1185,9 @@ parsenumber(struct compiling *co, char *s) static PyObject * decode_utf8(char **sPtr, char *end, char* encoding) { +#ifndef Py_USING_UNICODE + abort(); +#else PyObject *u, *v; char *s, *t; t = s = *sPtr; @@ -1197,6 +1200,7 @@ decode_utf8(char **sPtr, char *end, char* encoding) v = PyUnicode_AsEncodedString(u, encoding, NULL); Py_DECREF(u); return v; +#endif } static PyObject * @@ -1312,12 +1316,18 @@ parsestr(struct compiling *com, char *s) strcmp(encoding, "iso-8859-1") != 0); if (rawmode || strchr(s, '\\') == NULL) { if (need_encoding) { +#ifndef Py_USING_UNICODE + /* This should not happen - we never see any other + encoding. */ + abort(); +#else PyObject* u = PyUnicode_DecodeUTF8(s, len, NULL); if (u == NULL) return NULL; v = PyUnicode_AsEncodedString(u, encoding, NULL); Py_DECREF(u); return v; +#endif } else { return PyString_FromStringAndSize(s, len); } |
