mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as
an iterable of integers. Now only strings and byte-like objects are accepted.
This commit is contained in:
parent
bae5d81f5d
commit
9305d83425
6 changed files with 62 additions and 1 deletions
|
@ -3666,7 +3666,7 @@ PyUnicode_FSDecoder(PyObject* arg, void* addr)
|
|||
output = arg;
|
||||
Py_INCREF(output);
|
||||
}
|
||||
else {
|
||||
else if (PyObject_CheckBuffer(arg)) {
|
||||
arg = PyBytes_FromObject(arg);
|
||||
if (!arg)
|
||||
return 0;
|
||||
|
@ -3681,6 +3681,12 @@ PyUnicode_FSDecoder(PyObject* arg, void* addr)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"path should be string or bytes, not %.200s",
|
||||
Py_TYPE(arg)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
if (PyUnicode_READY(output) == -1) {
|
||||
Py_DECREF(output);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue