summaryrefslogtreecommitdiffstats
path: root/Lib/SocketServer.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-12-31 19:15:26 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-12-31 19:15:26 (GMT)
commita617271dbd150549b021a5161d009869ad62f7b2 (patch)
tree764221870afed35cab4c4bc8e07d31964a794fc4 /Lib/SocketServer.py
parent54266fce8db4c303a2c5ae84ecd0db493b400625 (diff)
downloadcpython-a617271dbd150549b021a5161d009869ad62f7b2.zip
cpython-a617271dbd150549b021a5161d009869ad62f7b2.tar.gz
cpython-a617271dbd150549b021a5161d009869ad62f7b2.tar.bz2
Use cStringIO where available.
Diffstat (limited to 'Lib/SocketServer.py')
-rw-r--r--Lib/SocketServer.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index 06ed134..345a6d1 100644
--- a/Lib/SocketServer.py
+++ b/Lib/SocketServer.py
@@ -575,10 +575,13 @@ class DatagramRequestHandler(BaseRequestHandler):
"""Define self.rfile and self.wfile for datagram sockets."""
def setup(self):
- import StringIO
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
self.packet, self.socket = self.request
- self.rfile = StringIO.StringIO(self.packet)
- self.wfile = StringIO.StringIO()
+ self.rfile = StringIO(self.packet)
+ self.wfile = StringIO()
def finish(self):
self.socket.sendto(self.wfile.getvalue(), self.client_address)