Message135249
Thank you for the patch. A couple of comments:
- the whole slow path (which loops calling _bufferedreader_raw_read()) should be surrounded by calls to ENTER_BUFFERED() and LEAVE_BUFFERED()
- other things:
+ if (!PyArg_ParseTuple(args, "O:readinto", &buffer))
+ return NULL;
+
+ if (PyObject_GetBuffer(buffer, &buf, PyBUF_CONTIG) == -1)
+ return NULL;
You should use the "w*" typecode instead (see the readinto implementation in Modules/_io/fileio.c for an example).
+ if (n == -2) {
+ Py_INCREF(Py_None);
+ res = Py_None;
+ }
If `written` is > 0, this should return the number of bytes instead (mimicking _bufferedreader_read_generic). Adding a test for that would be nice too (in Lib/test/test_io.py). |
|
Date |
User |
Action |
Args |
2011-05-05 21:28:35 | pitrou | set | recipients:
+ pitrou, benjamin.peterson, stutzbach, daniel.urban, jcon |
2011-05-05 21:28:34 | pitrou | set | messageid: <1304630914.99.0.604977677123.issue9971@psf.upfronthosting.co.za> |
2011-05-05 21:28:34 | pitrou | link | issue9971 messages |
2011-05-05 21:28:34 | pitrou | create | |
|