diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2007-06-12 05:53:00 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2007-06-12 05:53:00 +0000 |
commit | 427dbff8f04a3a34703bf8a1faec77ad334f1d01 (patch) | |
tree | 2b0d4f1b998364fcca10f1cd5f064c7c81cbd624 /Python | |
parent | 543c09e7004173a7504b004fc1c4bba695b3be5f (diff) | |
download | cpython-git-427dbff8f04a3a34703bf8a1faec77ad334f1d01.tar.gz |
Revert 55876. Use PyUnicode_AsEncodedString instead.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/codecs.c | 17 | ||||
-rw-r--r-- | Python/import.c | 6 |
2 files changed, 3 insertions, 20 deletions
diff --git a/Python/codecs.c b/Python/codecs.c index 1ba6009122..3aa1f386e7 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -319,23 +319,6 @@ PyObject *PyCodec_Encode(PyObject *object, PyObject *args = NULL, *result = NULL; PyObject *v; - /* XXX short-cut a few common file system - encodings for now, as otherwise the import - code can't load the codec registry. */ - if (strcmp(encoding, "utf-8") == 0 && PyUnicode_Check(object)) { - return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(object), - PyUnicode_GET_SIZE(object), - errors); - } -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) - if (strcmp(encoding, "mbcs") == 0 && PyUnicode_Check(object)) { - return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(object), - PyUnicode_GET_SIZE(object), - errors); - } -#endif - - encoder = PyCodec_Encoder(encoding); if (encoder == NULL) goto onError; diff --git a/Python/import.c b/Python/import.c index 0e4e50c8f5..4786f1b3ee 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2305,10 +2305,10 @@ ensure_fromlist(PyObject *mod, PyObject *fromlist, char *buf, Py_ssize_t buflen, if (!Py_FileSystemDefaultEncoding) { item8 = PyUnicode_EncodeASCII(PyUnicode_AsUnicode(item), PyUnicode_GetSize(item), - "strict"); + NULL); } else { - item8 = PyUnicode_AsEncodedObject(item, - Py_FileSystemDefaultEncoding, "strict"); + item8 = PyUnicode_AsEncodedString(item, + Py_FileSystemDefaultEncoding, NULL); } if (!item8) { PyErr_SetString(PyExc_ValueError, "Cannot encode path item"); |