Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ea2a46

Browse files
author
Victor Stinner
committed
Simplify PyUnicode_FSConverter(): remove reference to PyByteArray
PyByteArray is no more supported
1 parent 8130290 commit 0ea2a46

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

Objects/unicodeobject.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ PyUnicode_FSConverter(PyObject* arg, void* addr)
16381638
arg = PyUnicode_FromObject(arg);
16391639
if (!arg)
16401640
return 0;
1641-
output = PyUnicode_AsEncodedObject(arg,
1641+
output = PyUnicode_AsEncodedObject(arg,
16421642
Py_FileSystemDefaultEncoding,
16431643
"surrogateescape");
16441644
Py_DECREF(arg);
@@ -1650,14 +1650,8 @@ PyUnicode_FSConverter(PyObject* arg, void* addr)
16501650
return 0;
16511651
}
16521652
}
1653-
if (PyBytes_Check(output)) {
1654-
size = PyBytes_GET_SIZE(output);
1655-
data = PyBytes_AS_STRING(output);
1656-
}
1657-
else {
1658-
size = PyByteArray_GET_SIZE(output);
1659-
data = PyByteArray_AS_STRING(output);
1660-
}
1653+
size = PyBytes_GET_SIZE(output);
1654+
data = PyBytes_AS_STRING(output);
16611655
if (size != strlen(data)) {
16621656
PyErr_SetString(PyExc_TypeError, "embedded NUL character");
16631657
Py_DECREF(output);

0 commit comments

Comments
 (0)