summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 632ab04180..ab2616dee4 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -880,6 +880,11 @@ file_readinto(PyFileObject *f, PyObject *args)
if (f->f_fp == NULL)
return err_closed();
+ if (!f->f_binary) {
+ PyErr_SetString(PyExc_TypeError,
+ "readinto() requires binary mode");
+ return NULL;
+ }
/* refuse to mix with f.next() */
if (f->f_buf != NULL &&
(f->f_bufend - f->f_bufptr) > 0 &&