Mercurial > cpython-lru_cache-weakref
diff Lib/SocketServer.py @ 34293:cd517701fd93 legacy-trunk
Use cStringIO where available.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 31 Dec 2004 19:15:26 +0000 |
| parents | 298888e395ce |
| children | a1293ee6e1db |
line wrap: on
line diff
--- a/Lib/SocketServer.py Fri Dec 31 16:37:32 2004 +0000 +++ b/Lib/SocketServer.py Fri Dec 31 19:15:26 2004 +0000 @@ -575,10 +575,13 @@ """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)
