summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDavid Szotten <davidszotten@gmail.com>2020-06-15 23:53:57 (GMT)
committerGitHub <noreply@github.com>2020-06-15 23:53:57 (GMT)
commit8666356280084f0426c28a981341f72eaaacd006 (patch)
treecab3c37a749e036846d8cf6360d4fe84f4e30a81 /Modules
parent04fc4f2a46b2fd083639deb872c3a3037fdb47d6 (diff)
downloadcpython-8666356280084f0426c28a981341f72eaaacd006.zip
cpython-8666356280084f0426c28a981341f72eaaacd006.tar.gz
cpython-8666356280084f0426c28a981341f72eaaacd006.tar.bz2
closes bpo-28557: error message for bad raw readinto (GH-7496)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/bufferedio.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index f8e21f2..5984d34 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1483,6 +1483,15 @@ _bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len)
}
n = PyNumber_AsSsize_t(res, PyExc_ValueError);
Py_DECREF(res);
+
+ if (n == -1 && PyErr_Occurred()) {
+ _PyErr_FormatFromCause(
+ PyExc_OSError,
+ "raw readinto() failed"
+ );
+ return -1;
+ }
+
if (n < 0 || n > len) {
PyErr_Format(PyExc_OSError,
"raw readinto() returned invalid length %zd "