summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2012-08-04 12:38:16 (GMT)
committerGiampaolo Rodola' <g.rodola@gmail.com>2012-08-04 12:38:16 (GMT)
commitd9f38bc7043c6d94ea7d76249d48d18322b46e92 (patch)
tree1dac57ce47c0979a6c8562a82c7497ea8efe8c33 /Lib
parenta0e3febe5ae4b01f2076d1f0f09b76f366611a16 (diff)
downloadcpython-d9f38bc7043c6d94ea7d76249d48d18322b46e92.zip
cpython-d9f38bc7043c6d94ea7d76249d48d18322b46e92.tar.gz
cpython-d9f38bc7043c6d94ea7d76249d48d18322b46e92.tar.bz2
asynchat speedup improvement: avoid to use a function mimicking old buffer() builtin behavior; instead use plain slicing
Diffstat (limited to 'Lib')
-rw-r--r--Lib/asynchat.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index 2199d1b..4e26bb5 100644
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -49,18 +49,6 @@ import socket
import asyncore
from collections import deque
-def buffer(obj, start=None, stop=None):
- # if memoryview objects gain slicing semantics,
- # this function will change for the better
- # memoryview used for the TypeError
- memoryview(obj)
- if start == None:
- start = 0
- if stop == None:
- stop = len(obj)
- x = obj[start:stop]
- ## print("buffer type is: %s"%(type(x),))
- return x
class async_chat (asyncore.dispatcher):
"""This is an abstract class. You must derive from this class, and add
@@ -240,7 +228,7 @@ class async_chat (asyncore.dispatcher):
# handle classic producer behavior
obs = self.ac_out_buffer_size
try:
- data = buffer(first, 0, obs)
+ data = first[:obs]
except TypeError:
data = first.more()
if data: