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.
This commit is contained in:
Brett Cannon 2008-08-08 04:27:28 +00:00
parent 03446c43ca
commit 3f92bc6f48
2 changed files with 7 additions and 7 deletions

View File

@ -407,8 +407,8 @@ class _fileobject(object):
nl = data.find('\n') nl = data.find('\n')
if nl >= 0: if nl >= 0:
nl += 1 nl += 1
buf.write(buffer(data, 0, nl)) buf.write(data[:nl])
self._rbuf.write(buffer(data, nl)) self._rbuf.write(data[nl:])
del data del data
break break
buf.write(data) buf.write(data)
@ -434,9 +434,9 @@ class _fileobject(object):
if nl >= 0: if nl >= 0:
nl += 1 nl += 1
# save the excess data to _rbuf # save the excess data to _rbuf
self._rbuf.write(buffer(data, nl)) self._rbuf.write(data[nl:])
if buf_len: if buf_len:
buf.write(buffer(data, 0, nl)) buf.write(data[:nl])
break break
else: else:
# Shortcut. Avoid data copy through buf when returning # Shortcut. Avoid data copy through buf when returning
@ -448,8 +448,8 @@ class _fileobject(object):
# returning exactly all of our first recv(). # returning exactly all of our first recv().
return data return data
if n >= left: if n >= left:
buf.write(buffer(data, 0, left)) buf.write(data[:left])
self._rbuf.write(buffer(data, left)) self._rbuf.write(data[left:])
break break
buf.write(data) buf.write(data)
buf_len += n buf_len += n

View File

@ -48,7 +48,7 @@ Library
while running under the ``-3`` flag: aifc, asyncore, bdb, bsddb, while running under the ``-3`` flag: aifc, asyncore, bdb, bsddb,
ConfigParser, cookielib, DocXMLRPCServer, email, filecmp, fileinput, inspect, ConfigParser, cookielib, DocXMLRPCServer, email, filecmp, fileinput, inspect,
logging, modulefinder, pdb, pickle, profile, pstats, pydoc, re, rlcompleter, logging, modulefinder, pdb, pickle, profile, pstats, pydoc, re, rlcompleter,
SimpleXMLRPCServer, shelve, subprocess, sqlite3, tarfile, Tkinter, SimpleXMLRPCServer, shelve, socket, subprocess, sqlite3, tarfile, Tkinter,
test.test_support, textwrap, threading, tokenize, traceback, urlparse, test.test_support, textwrap, threading, tokenize, traceback, urlparse,
wsgiref, xml, xmlrpclib. wsgiref, xml, xmlrpclib.