Merging the py3k-pep3137 branch back into the py3k branch.
No detailed change log; just check out the change log for the py3k-pep3137
branch.  The most obvious changes:

  - str8 renamed to bytes (PyString at the C level);
  - bytes renamed to buffer (PyBytes at the C level);
  - PyString and PyUnicode are no longer compatible.

I.e. we now have an immutable bytes type and a mutable bytes type.

The behavior of PyString was modified quite a bit, to make it more
bytes-like.  Some changes are still on the to-do list.
diff --git a/Lib/io.py b/Lib/io.py
index cbbcc26..b305b53 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -391,7 +391,7 @@
                 return 1
         if limit is None:
             limit = -1
-        res = bytes()
+        res = buffer()
         while limit < 0 or len(res) < limit:
             b = self.read(nreadahead())
             if not b:
@@ -399,7 +399,7 @@
             res += b
             if res.endswith(b"\n"):
                 break
-        return res
+        return bytes(res)
 
     def __iter__(self):
         self._checkClosed()
@@ -454,20 +454,20 @@
             n = -1
         if n < 0:
             return self.readall()
-        b = bytes(n.__index__())
+        b = buffer(n.__index__())
         n = self.readinto(b)
         del b[n:]
-        return b
+        return bytes(b)
 
     def readall(self):
         """readall() -> bytes.  Read until EOF, using multiple read() call."""
-        res = bytes()
+        res = buffer()
         while True:
             data = self.read(DEFAULT_BUFFER_SIZE)
             if not data:
                 break
             res += data
-        return res
+        return bytes(res)
 
     def readinto(self, b: bytes) -> int:
         """readinto(b: bytes) -> int.  Read up to len(b) bytes into b.
@@ -655,14 +655,14 @@
     # XXX More docs
 
     def __init__(self, initial_bytes=None):
-        buffer = b""
+        buf = buffer()
         if initial_bytes is not None:
-            buffer += initial_bytes
-        self._buffer = buffer
+            buf += initial_bytes
+        self._buffer = buf
         self._pos = 0
 
     def getvalue(self):
-        return self._buffer
+        return bytes(self._buffer)
 
     def read(self, n=None):
         if n is None:
@@ -672,7 +672,7 @@
         newpos = min(len(self._buffer), self._pos + n)
         b = self._buffer[self._pos : newpos]
         self._pos = newpos
-        return b
+        return bytes(b)
 
     def read1(self, n):
         return self.read(n)
@@ -819,7 +819,7 @@
         self.max_buffer_size = (2*buffer_size
                                 if max_buffer_size is None
                                 else max_buffer_size)
-        self._write_buf = b""
+        self._write_buf = buffer()
 
     def write(self, b):
         if self.closed:
@@ -1186,7 +1186,7 @@
         try:
             decoder.setstate((b"", decoder_state))
             n = 0
-            bb = bytes(1)
+            bb = buffer(1)
             for i, bb[0] in enumerate(readahead):
                 n += len(decoder.decode(bb))
                 if n >= needed:
@@ -1266,7 +1266,9 @@
         return line
 
     def readline(self, limit=None):
-        if limit is not None:
+        if limit is None:
+            limit = -1
+        if limit >= 0:
             # XXX Hack to support limit argument, for backwards compatibility
             line = self.readline()
             if len(line) <= limit: