import os
+from array import array
from test_support import verify, TESTFN
from UserList import UserList
f.close()
verify(buf == '12')
+# verify readinto
+a = array('c', 'x'*10)
+f = open(TESTFN, 'rb')
+n = f.readinto(a)
+f.close()
+verify(buf == a.tostring()[:n])
+
# verify writelines with integers
f = open(TESTFN, 'wb')
try:
if f.closed:
raise TestError, 'file.closed should be false'
+try:
+ f.readinto("")
+except TypeError:
+ pass
+else:
+ raise TestError, 'file.readinto("") should raise a TypeError'
+
f.close()
if not f.closed:
raise TestError, 'file.closed should be true'
if (f->f_fp == NULL)
return err_closed();
- if (!PyArg_Parse(args, "w#", &ptr, &ntodo))
+ if (!PyArg_ParseTuple(args, "w#", &ptr, &ntodo))
return NULL;
ndone = 0;
while (ntodo > 0) {
{"truncate", (PyCFunction)file_truncate, METH_VARARGS, truncate_doc},
#endif
{"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc},
- {"readinto", (PyCFunction)file_readinto, METH_OLDARGS, readinto_doc},
+ {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc},
{"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc},
{"xreadlines", (PyCFunction)file_xreadlines, METH_NOARGS, xreadlines_doc},
{"writelines", (PyCFunction)file_writelines, METH_O, writelines_doc},