[Pkg-bitcoin-commits] [python-quamash] 59/269: Disconnect discarded notifiers

Jonas Smedegaard dr at jones.dk
Fri Nov 24 11:26:16 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository python-quamash.

commit 219bd3ed6e68bd72f4a64f02f79105fe53cafca7
Author: Arve Knudsen <arve.knudsen at gmail.com>
Date:   Sat Jul 5 19:27:04 2014 +0200

    Disconnect discarded notifiers
---
 quamash/_unix.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/quamash/_unix.py b/quamash/_unix.py
index 99a2320..3c8f86f 100644
--- a/quamash/_unix.py
+++ b/quamash/_unix.py
@@ -121,19 +121,21 @@ class _Selector(selectors.BaseSelector):
 			self.__parent._process_event(key, EVENT_WRITE & key.events)
 
 	def unregister(self, fileobj):
+		def drop_notifier(notifiers):
+			try:
+				notifier = notifiers.pop(key.fd)
+			except KeyError:
+				pass
+			else:
+				notifier.activated.disconnect()
+
 		try:
 			key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
 		except KeyError:
 			raise KeyError("{!r} is not registered".format(fileobj)) from None
 
-		try:
-			del self.__read_notifiers[key.fd]
-		except KeyError:
-			pass
-		try:
-			del self.__write_notifiers[key.fd]
-		except KeyError:
-			pass
+		drop_notifier(self.__read_notifiers)
+		drop_notifier(self.__write_notifiers)
 
 		return key
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/python-quamash.git



More information about the Pkg-bitcoin-commits mailing list