]> granicus.if.org Git - python/commitdiff
Replaced "string" with "bytes object" in docstrings of binary I/O objects.
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 9 Apr 2015 23:19:57 +0000 (02:19 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 9 Apr 2015 23:19:57 +0000 (02:19 +0300)
1  2 
Modules/_io/bytesio.c
Modules/_io/fileio.c

index fc4ea74b23f370055db474ec26213319dacce33e,4652356f318504c6ef273d56fb1fbae39cb5eb5e..974e33ac2a481b296bbdf6410f0107f6d39acd62
@@@ -304,31 -257,11 +304,31 @@@ bytesio_tell(bytesio *self
      return PyLong_FromSsize_t(self->pos);
  }
  
 +static PyObject *
 +read_bytes(bytesio *self, Py_ssize_t size)
 +{
 +    char *output;
 +
 +    assert(self->buf != NULL);
 +    assert(size <= self->string_size);
 +    if (size > 1 &&
 +        self->pos == 0 && size == PyBytes_GET_SIZE(self->buf) &&
 +        self->exports == 0) {
 +        self->pos += size;
 +        Py_INCREF(self->buf);
 +        return self->buf;
 +    }
 +
 +    output = PyBytes_AS_STRING(self->buf) + self->pos;
 +    self->pos += size;
 +    return PyBytes_FromStringAndSize(output, size);
 +}
 +
  PyDoc_STRVAR(read_doc,
- "read([size]) -> read at most size bytes, returned as a string.\n"
+ "read([size]) -> read at most size bytes, returned as a bytes object.\n"
  "\n"
  "If the size argument is negative, read until EOF is reached.\n"
- "Return an empty string at EOF.");
+ "Return an empty bytes object at EOF.");
  
  static PyObject *
  bytesio_read(bytesio *self, PyObject *args)
Simple merge