mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Added much functionality to the bytes type.
Change file.readinto() to require binary mode.
This commit is contained in:
parent
e06b6b8ff5
commit
d624f18a21
5 changed files with 709 additions and 198 deletions
|
@ -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 &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue