[Python-checkins] r56151 - python/branches/cpy_merge/Modules/_bytes_iomodule.c
alexandre.vassalotti
python-checkins at python.org
Mon Jul 2 22:39:49 CEST 2007
Author: alexandre.vassalotti
Date: Mon Jul 2 22:39:49 2007
New Revision: 56151
Modified:
python/branches/cpy_merge/Modules/_bytes_iomodule.c
Log:
Make readinto set the buffer position correctly.
Fix a minor error with the docstring of readinto.
Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c
==============================================================================
--- python/branches/cpy_merge/Modules/_bytes_iomodule.c (original)
+++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Mon Jul 2 22:39:49 2007
@@ -286,8 +286,8 @@
if (PyObject_AsWriteBuffer(buffer, &raw_buffer, &len) == -1)
return NULL;
- if (len > self->string_size)
- len = self->string_size;
+ if (self->pos + len > self->string_size)
+ len = self->string_size - self->pos;
memcpy(raw_buffer, self->buf + self->pos, len);
self->pos += len;
@@ -539,7 +539,7 @@
"readinto(bytes) -> int. Read up to len(b) bytes into b.\n"
"\n"
"Returns number of bytes read (0 for EOF), or None if the object\n"
-"is set not to block as has no data to read."
+"is set not to block as has no data to read.");
PyDoc_STRVAR(BytesIO_tell_doc,
"tell() -> current file position, an integer\n");
More information about the Python-checkins
mailing list