summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-08-08 04:27:28 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-08-08 04:27:28 (GMT)
commit3f92bc6f4811241ac68ec2681895d22ba8c68bf0 (patch)
tree43a11c77f209ceda2bd30d6bec38c75e6766de4b /Lib/socket.py
parent03446c43ca3a4be2097782f590b71a596a0158cc (diff)
downloadcpython-3f92bc6f4811241ac68ec2681895d22ba8c68bf0.zip
cpython-3f92bc6f4811241ac68ec2681895d22ba8c68bf0.tar.gz
cpython-3f92bc6f4811241ac68ec2681895d22ba8c68bf0.tar.bz2
Remove buffer() usage in the socket module by just slicing directly on the
object. This removes all warnings for the module caused by running under -3.
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 6dcd1a6..24ef3af 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -407,8 +407,8 @@ class _fileobject(object):
nl = data.find('\n')
if nl >= 0:
nl += 1
- buf.write(buffer(data, 0, nl))
- self._rbuf.write(buffer(data, nl))
+ buf.write(data[:nl])
+ self._rbuf.write(data[nl:])
del data
break
buf.write(data)
@@ -434,9 +434,9 @@ class _fileobject(object):
if nl >= 0:
nl += 1
# save the excess data to _rbuf
- self._rbuf.write(buffer(data, nl))
+ self._rbuf.write(data[nl:])
if buf_len:
- buf.write(buffer(data, 0, nl))
+ buf.write(data[:nl])
break
else:
# Shortcut. Avoid data copy through buf when returning
@@ -448,8 +448,8 @@ class _fileobject(object):
# returning exactly all of our first recv().
return data
if n >= left:
- buf.write(buffer(data, 0, left))
- self._rbuf.write(buffer(data, left))
+ buf.write(data[:left])
+ self._rbuf.write(data[left:])
break
buf.write(data)
buf_len += n