Removing all calls to sys.exc_clear(). This is only necessary in very rare circumstances, and if there is such a circumstance, it should be clearly documented in code.
This commit is contained in:
parent
9e3e14dd78
commit
4617618463
4 changed files with 0 additions and 8 deletions
|
@ -135,7 +135,6 @@ class Dispatcher(PlugIn):
|
|||
self._owner.Connection.disconnect()
|
||||
return 0
|
||||
except ExpatError:
|
||||
sys.exc_clear()
|
||||
self.DEBUG('Invalid XML received from server. Forcing disconnect.', 'error')
|
||||
self._owner.Connection.pollend()
|
||||
return 0
|
||||
|
|
|
@ -249,7 +249,6 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
self._sock.setblocking(False)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
sys.exc_clear()
|
||||
if self.on_connect_failure:
|
||||
self.on_connect_failure()
|
||||
return False
|
||||
|
@ -303,7 +302,6 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
except:
|
||||
traceback.print_exc()
|
||||
# socket is already closed
|
||||
sys.exc_clear()
|
||||
# socket descriptor cannot be (un)plugged anymore
|
||||
self.fd = -1
|
||||
if self.on_disconnect:
|
||||
|
@ -432,7 +430,6 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
self._on_send()
|
||||
except socket.error, e:
|
||||
traceback.print_exc()
|
||||
sys.exc_clear()
|
||||
if e[0] == socket.SSL_ERROR_WANT_WRITE:
|
||||
return True
|
||||
if self.state < 0:
|
||||
|
@ -453,7 +450,6 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
except socket.error, e:
|
||||
traceback.print_exc()
|
||||
errnum = e[0]
|
||||
sys.exc_clear()
|
||||
# in progress, or would block
|
||||
if errnum in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK):
|
||||
return
|
||||
|
|
|
@ -377,7 +377,6 @@ class P2PConnection(IdleObject, PlugIn):
|
|||
except Exception, e:
|
||||
if len(e.args) > 0 and isinstance(e.args[0], int):
|
||||
errnum = e[0]
|
||||
sys.exc_clear()
|
||||
# "received" will be empty anyhow
|
||||
if errnum == socket.SSL_ERROR_WANT_READ:
|
||||
pass
|
||||
|
@ -457,7 +456,6 @@ class P2PConnection(IdleObject, PlugIn):
|
|||
self._on_send()
|
||||
|
||||
except socket.error, e:
|
||||
sys.exc_clear()
|
||||
if e[0] == socket.SSL_ERROR_WANT_WRITE:
|
||||
return True
|
||||
if self.state < 0:
|
||||
|
|
|
@ -27,7 +27,6 @@ from common import i18n
|
|||
try:
|
||||
PREFERRED_ENCODING = locale.getpreferredencoding()
|
||||
except:
|
||||
sys.exc_clear()
|
||||
PREFERRED_ENCODING = 'UTF-8'
|
||||
|
||||
def send_error(error_message):
|
||||
|
|
Loading…
Add table
Reference in a new issue