summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-04-24 13:47:05 +0000
committerGuido van Rossum <guido@python.org>2006-04-24 13:47:05 +0000
commitd624f18a2167daeabc85c1fef7e71dbc93daf5b5 (patch)
tree32be0f71bf46f0b459adc6f21f464dbf43a96ded /Objects/fileobject.c
parente06b6b8ff5a380f5e107f2d28f23853bfe20021e (diff)
downloadcpython-git-d624f18a2167daeabc85c1fef7e71dbc93daf5b5.tar.gz
Added much functionality to the bytes type.
Change file.readinto() to require binary 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 &&