diff --git a/qasync/__init__.py b/qasync/__init__.py index f68c945..e29c41f 100644 --- a/qasync/__init__.py +++ b/qasync/__init__.py @@ -394,13 +394,13 @@ def add_reader(self, fd, callback, *args): else: # this is necessary to avoid race condition-like issues existing.setEnabled(False) - existing.activated.disconnect() + existing.activated['int'].disconnect() # will get overwritten by the assignment below anyways notifier = QtCore.QSocketNotifier(fd, QtCore.QSocketNotifier.Read) notifier.setEnabled(True) self._logger.debug('Adding reader callback for file descriptor {}'.format(fd)) - notifier.activated.connect( + notifier.activated['int'].connect( lambda: self.__on_notifier_ready( self._read_notifiers, notifier, fd, callback, args) # noqa: C812 ) @@ -430,13 +430,13 @@ def add_writer(self, fd, callback, *args): else: # this is necessary to avoid race condition-like issues existing.setEnabled(False) - existing.activated.disconnect() + existing.activated['int'].disconnect() # will get overwritten by the assignment below anyways notifier = QtCore.QSocketNotifier(fd, QtCore.QSocketNotifier.Write) notifier.setEnabled(True) self._logger.debug('Adding writer callback for file descriptor {}'.format(fd)) - notifier.activated.connect( + notifier.activated['int'].connect( lambda: self.__on_notifier_ready( self._write_notifiers, notifier, fd, callback, args) # noqa: C812 ) @@ -470,7 +470,7 @@ def __notifier_cb_wrapper(self, notifiers, notifier, fd, callback, args): if notifiers.get(fd, None) is notifier: notifier.setEnabled(True) else: - notifier.activated.disconnect() + notifier.activated['int'].disconnect() def __on_notifier_ready(self, notifiers, notifier, fd, callback, args): if fd not in notifiers: diff --git a/qasync/_unix.py b/qasync/_unix.py index debe703..d924290 100644 --- a/qasync/_unix.py +++ b/qasync/_unix.py @@ -110,11 +110,11 @@ def register(self, fileobj, events, data=None): if events & EVENT_READ: notifier = QtCore.QSocketNotifier(key.fd, QtCore.QSocketNotifier.Read) - notifier.activated.connect(self.__on_read_activated) + notifier.activated['int'].connect(self.__on_read_activated) self.__read_notifiers[key.fd] = notifier if events & EVENT_WRITE: notifier = QtCore.QSocketNotifier(key.fd, QtCore.QSocketNotifier.Write) - notifier.activated.connect(self.__on_write_activated) + notifier.activated['int'].connect(self.__on_write_activated) self.__write_notifiers[key.fd] = notifier return key @@ -138,7 +138,7 @@ def drop_notifier(notifiers): except KeyError: pass else: - notifier.activated.disconnect() + notifier.activated['int'].disconnect() try: key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))