mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Sockets facelift. APIs that could return binary data (e.g. aton() and
recv()) now return bytes, not str or str8. The socket.py code is redone; it now subclasses _socket.socket and instead of having its own _fileobject for makefile(), it uses io.SocketIO. Some stuff in io.py was moved around to make this work. (I really need to rethink my policy regarding readline() and read(-1) on raw files; and readline() on buffered files ought to use peeking(). Later.)
This commit is contained in:
parent
88effc1251
commit
7d0a8264ff
5 changed files with 200 additions and 516 deletions
|
@ -1085,10 +1085,8 @@ class AbstractHTTPHandler(BaseHandler):
|
|||
# to read(). This weird wrapping allows the returned object to
|
||||
# have readline() and readlines() methods.
|
||||
|
||||
# XXX It might be better to extract the read buffering code
|
||||
# out of socket._fileobject() and into a base class.
|
||||
|
||||
r.recv = r.read
|
||||
# XXX socket._fileobject is gone; use some class from io.py instead
|
||||
fp = socket._fileobject(r, close=True)
|
||||
|
||||
resp = addinfourl(fp, r.msg, req.get_full_url())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue