summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-23 21:36:13 +0100
committermathieui <mathieui@mathieui.net>2015-02-24 19:08:12 +0100
commitdbd8115557f7f1b88b82ed23c0fb312b4d15100f (patch)
tree9dd30549288e5aea17f6c316e11fb76eb2c5c04b
parent74b4ea20bf369aec8196fd65cc80e717198a37bb (diff)
downloadslixmpp-dbd8115557f7f1b88b82ed23c0fb312b4d15100f.tar.gz
slixmpp-dbd8115557f7f1b88b82ed23c0fb312b4d15100f.tar.bz2
slixmpp-dbd8115557f7f1b88b82ed23c0fb312b4d15100f.tar.xz
slixmpp-dbd8115557f7f1b88b82ed23c0fb312b4d15100f.zip
Remove the filesocket shim (2.6 compatibility)
-rw-r--r--slixmpp/xmlstream/filesocket.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/slixmpp/xmlstream/filesocket.py b/slixmpp/xmlstream/filesocket.py
deleted file mode 100644
index 1b52251e..00000000
--- a/slixmpp/xmlstream/filesocket.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
- slixmpp.xmlstream.filesocket
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- This module is a shim for correcting deficiencies in the file
- socket implementation of Python2.6.
-
- Part of Slixmpp: The Slick XMPP Library
-
- :copyright: (c) 2011 Nathanael C. Fritz
- :license: MIT, see LICENSE for more details
-"""
-
-from socket import _fileobject
-import errno
-import socket
-
-
-class FileSocket(_fileobject):
-
- """Create a file object wrapper for a socket to work around
- issues present in Python 2.6 when using sockets as file objects.
-
- The parser for :class:`~xml.etree.cElementTree` requires a file, but
- we will be reading from the XMPP connection socket instead.
- """
-
- def read(self, size=4096):
- """Read data from the socket as if it were a file."""
- if self._sock is None:
- return None
- while True:
- try:
- data = self._sock.recv(size)
- break
- except socket.error as serr:
- if serr.errno != errno.EINTR:
- raise
- if data is not None:
- return data
-
-
-class Socket26(socket.socket):
-
- """A custom socket implementation that uses our own FileSocket class
- to work around issues in Python 2.6 when using sockets as files.
- """
-
- def makefile(self, mode='r', bufsize=-1):
- """makefile([mode[, bufsize]]) -> file object
- Return a regular file object corresponding to the socket. The mode
- and bufsize arguments are as for the built-in open() function."""
- return FileSocket(self._sock, mode, bufsize)