From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6E8F01382C5 for ; Sun, 29 Apr 2018 21:29:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ABC67E0B3B; Sun, 29 Apr 2018 21:29:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8B7F2E0B3B for ; Sun, 29 Apr 2018 21:29:20 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 98C16335C9F for ; Sun, 29 Apr 2018 21:29:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D4479288 for ; Sun, 29 Apr 2018 21:29:17 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1525032223.b2ba35d4704172e8ddbfa0c98900f4b6ed20416b.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/AbstractPollTask.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: b2ba35d4704172e8ddbfa0c98900f4b6ed20416b X-VCS-Branch: master Date: Sun, 29 Apr 2018 21:29:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8d02ff56-0c29-4cd5-89f7-cbb49253fab7 X-Archives-Hash: 954d84e5501085319d97c8d6411a08cf commit: b2ba35d4704172e8ddbfa0c98900f4b6ed20416b Author: Zac Medico gentoo org> AuthorDate: Sun Apr 29 20:03:05 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Apr 29 20:03:43 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b2ba35d4 AbstractPollTask: call _unregister in _async_wait (bug 654276) Subclasses of AbstractPollTask perform idempotent cleanup in the _unregister method, so it's useful for _async_wait to call it automatically. This allows for migration of various cleanup code from _set_returncode to _unregister, for the purposes of bug 654276. Bug: https://bugs.gentoo.org/654276 pym/_emerge/AbstractPollTask.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/AbstractPollTask.py b/pym/_emerge/AbstractPollTask.py index 0ce3594b4..2c5403751 100644 --- a/pym/_emerge/AbstractPollTask.py +++ b/pym/_emerge/AbstractPollTask.py @@ -114,8 +114,12 @@ class AbstractPollTask(AsynchronousTask): return buf + def _async_wait(self): + self._unregister() + super(AbstractPollTask, self)._async_wait() + def _unregister(self): - raise NotImplementedError(self) + self._registered = False def _log_poll_exception(self, event): writemsg_level( @@ -127,12 +131,10 @@ class AbstractPollTask(AsynchronousTask): if self._registered: if event & self._exceptional_events: self._log_poll_exception(event) - self._unregister() self.cancel() self.returncode = self.returncode or os.EX_OK self._async_wait() elif event & self.scheduler.IO_HUP: - self._unregister() self.returncode = self.returncode or os.EX_OK self._async_wait()