Added much functionality to the bytes type.

Change file.readinto() to require binary mode.
This commit is contained in:
Guido van Rossum 2006-04-24 13:47:05 +00:00
parent e06b6b8ff5
commit d624f18a21
5 changed files with 709 additions and 198 deletions

View file

@ -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 &&