Commit 0ea2a468 authored by Victor Stinner's avatar Victor Stinner

Simplify PyUnicode_FSConverter(): remove reference to PyByteArray

PyByteArray is no more supported
parent 8130290d
...@@ -1638,7 +1638,7 @@ PyUnicode_FSConverter(PyObject* arg, void* addr) ...@@ -1638,7 +1638,7 @@ PyUnicode_FSConverter(PyObject* arg, void* addr)
arg = PyUnicode_FromObject(arg); arg = PyUnicode_FromObject(arg);
if (!arg) if (!arg)
return 0; return 0;
output = PyUnicode_AsEncodedObject(arg, output = PyUnicode_AsEncodedObject(arg,
Py_FileSystemDefaultEncoding, Py_FileSystemDefaultEncoding,
"surrogateescape"); "surrogateescape");
Py_DECREF(arg); Py_DECREF(arg);
...@@ -1650,14 +1650,8 @@ PyUnicode_FSConverter(PyObject* arg, void* addr) ...@@ -1650,14 +1650,8 @@ PyUnicode_FSConverter(PyObject* arg, void* addr)
return 0; return 0;
} }
} }
if (PyBytes_Check(output)) { size = PyBytes_GET_SIZE(output);
size = PyBytes_GET_SIZE(output); data = PyBytes_AS_STRING(output);
data = PyBytes_AS_STRING(output);
}
else {
size = PyByteArray_GET_SIZE(output);
data = PyByteArray_AS_STRING(output);
}
if (size != strlen(data)) { if (size != strlen(data)) {
PyErr_SetString(PyExc_TypeError, "embedded NUL character"); PyErr_SetString(PyExc_TypeError, "embedded NUL character");
Py_DECREF(output); Py_DECREF(output);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment