This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients benjamin.peterson, daniel.urban, jcon, pitrou, stutzbach
Date 2011-05-05.21:28:34
SpamBayes Score 4.1755232e-08
Marked as misclassified No
Message-id <1304630914.99.0.604977677123.issue9971@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2011-05-05 21:28:35pitrousetrecipients: + pitrou, benjamin.peterson, stutzbach, daniel.urban, jcon
2011-05-05 21:28:34pitrousetmessageid: <1304630914.99.0.604977677123.issue9971@psf.upfronthosting.co.za>
2011-05-05 21:28:34pitroulinkissue9971 messages
2011-05-05 21:28:34pitroucreate