[Python-checkins] cpython (merge 3.3 -> default): Fix empty strings to empty bytes objects.

serhiy.storchaka python-checkins at python.org
Thu Feb 6 20:13:56 CET 2014


http://hg.python.org/cpython/rev/50d18b5ac776
changeset:   88998:50d18b5ac776
parent:      88996:a46862fc4d18
parent:      88997:733e19123915
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Feb 06 21:11:33 2014 +0200
summary:
  Fix empty strings to empty bytes objects.

files:
  Doc/library/asynchat.rst              |  6 +++---
  Doc/library/asyncore.rst              |  3 ++-
  Doc/library/chunk.rst                 |  8 ++++----
  Doc/library/xml.etree.elementtree.rst |  2 +-
  Doc/library/zlib.rst                  |  2 +-
  5 files changed, 11 insertions(+), 10 deletions(-)


diff --git a/Doc/library/asynchat.rst b/Doc/library/asynchat.rst
--- a/Doc/library/asynchat.rst
+++ b/Doc/library/asynchat.rst
@@ -61,8 +61,8 @@
    have only one method, :meth:`more`, which should return data to be
    transmitted on the channel.
    The producer indicates exhaustion (*i.e.* that it contains no more data) by
-   having its :meth:`more` method return the empty string. At this point the
-   :class:`async_chat` object removes the producer from the fifo and starts
+   having its :meth:`more` method return the empty bytes object. At this point
+   the :class:`async_chat` object removes the producer from the fifo and starts
    using the next producer, if any. When the producer fifo is empty the
    :meth:`handle_write` method does nothing. You use the channel object's
    :meth:`set_terminator` method to describe how to recognize the end of, or
@@ -226,7 +226,7 @@
        def found_terminator(self):
            if self.reading_headers:
                self.reading_headers = False
-               self.parse_headers("".join(self.ibuffer))
+               self.parse_headers(b"".join(self.ibuffer))
                self.ibuffer = []
                if self.op.upper() == b"POST":
                    clen = self.headers.getheader("content-length")
diff --git a/Doc/library/asyncore.rst b/Doc/library/asyncore.rst
--- a/Doc/library/asyncore.rst
+++ b/Doc/library/asyncore.rst
@@ -213,7 +213,8 @@
    .. method:: recv(buffer_size)
 
       Read at most *buffer_size* bytes from the socket's remote end-point.  An
-      empty string implies that the channel has been closed from the other end.
+      empty bytes object implies that the channel has been closed from the
+      other end.
 
 
    .. method:: listen(backlog)
diff --git a/Doc/library/chunk.rst b/Doc/library/chunk.rst
--- a/Doc/library/chunk.rst
+++ b/Doc/library/chunk.rst
@@ -113,15 +113,15 @@
 
       Read at most *size* bytes from the chunk (less if the read hits the end of
       the chunk before obtaining *size* bytes).  If the *size* argument is
-      negative or omitted, read all data until the end of the chunk.  The bytes
-      are returned as a string object.  An empty string is returned when the end
-      of the chunk is encountered immediately.
+      negative or omitted, read all data until the end of the chunk.  An empty
+      bytes object is returned when the end of the chunk is encountered
+      immediately.
 
 
    .. method:: skip()
 
       Skip to the end of the chunk.  All further calls to :meth:`read` for the
-      chunk will return ``''``.  If you are not interested in the contents of
+      chunk will return ``b''``.  If you are not interested in the contents of
       the chunk, this method should be called so that the file points to the
       start of the next chunk.
 
diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst
--- a/Doc/library/xml.etree.elementtree.rst
+++ b/Doc/library/xml.etree.elementtree.rst
@@ -511,7 +511,7 @@
    *short_empty_elements* has the same meaning as in :meth:`ElementTree.write`.
    Returns a list of (optionally) encoded strings containing the XML data.
    It does not guarantee any specific sequence, except that
-   ``"".join(tostringlist(element)) == tostring(element)``.
+   ``b"".join(tostringlist(element)) == tostring(element)``.
 
    .. versionadded:: 3.2
 
diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst
--- a/Doc/library/zlib.rst
+++ b/Doc/library/zlib.rst
@@ -197,7 +197,7 @@
 .. attribute:: Decompress.unused_data
 
    A bytes object which contains any bytes past the end of the compressed data. That is,
-   this remains ``""`` until the last byte that contains compression data is
+   this remains ``b""`` until the last byte that contains compression data is
    available.  If the whole bytestring turned out to contain compressed data, this is
    ``b""``, an empty bytes object.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list