summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-18 10:56:16 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-18 10:56:16 (GMT)
commitf95de0e8cc259b1ccb6b604a0ed74bb7894f4b2b (patch)
tree24ae043565544e6b02d39b127439b987b144d0d8 /Objects
parent2fec611a70ba862a4127b7656a6d98d48850c3af (diff)
parent9305d83425e2ec63b2769336907dd07b3151cd5f (diff)
downloadcpython-f95de0e8cc259b1ccb6b604a0ed74bb7894f4b2b.zip
cpython-f95de0e8cc259b1ccb6b604a0ed74bb7894f4b2b.tar.gz
cpython-f95de0e8cc259b1ccb6b604a0ed74bb7894f4b2b.tar.bz2
Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as
an iterable of integers. Now only strings and byte-like objects are accepted.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7de44ce..db6a51c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3837,7 +3837,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;
@@ -3852,6 +3852,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;