diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-30 00:22:08 +0000 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-30 00:22:08 +0000 |
| commit | ac0af911cf4e10fe26faa2d45b6c097f4ca47174 (patch) | |
| tree | ce44b918348ee773dbc5b98d71693e7b5714620a | |
| parent | 7e53d865ecb0ccaedd22b1fe1aa6a7378cfc98fd (diff) | |
| download | cpython-ac0af911cf4e10fe26faa2d45b6c097f4ca47174.tar.gz | |
Simplify PyUnicode_FSConverter(): remove reference to PyByteArray
PyByteArray is no more supported
| -rw-r--r-- | Objects/unicodeobject.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 3851008a88..369306e368 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1638,7 +1638,7 @@ PyUnicode_FSConverter(PyObject* arg, void* addr) arg = PyUnicode_FromObject(arg); if (!arg) return 0; - output = PyUnicode_AsEncodedObject(arg, + output = PyUnicode_AsEncodedObject(arg, Py_FileSystemDefaultEncoding, "surrogateescape"); Py_DECREF(arg); @@ -1650,14 +1650,8 @@ PyUnicode_FSConverter(PyObject* arg, void* addr) return 0; } } - if (PyBytes_Check(output)) { - size = PyBytes_GET_SIZE(output); - data = PyBytes_AS_STRING(output); - } - else { - size = PyByteArray_GET_SIZE(output); - data = PyByteArray_AS_STRING(output); - } + size = PyBytes_GET_SIZE(output); + data = PyBytes_AS_STRING(output); if (size != strlen(data)) { PyErr_SetString(PyExc_TypeError, "embedded NUL character"); Py_DECREF(output); |
