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 7425B139085 for ; Wed, 8 Feb 2017 09:39:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 931A7E0CBF; Wed, 8 Feb 2017 09:39:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6B55CE0CBF for ; Wed, 8 Feb 2017 09:39:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3ADA634169C for ; Wed, 8 Feb 2017 09:39:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D770B3D9B for ; Wed, 8 Feb 2017 09:39:55 +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: <1486545049.855c8761f85323bbe570ae61e87c57dc8ea5ea0e.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_async/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/_async/PopenProcess.py X-VCS-Directories: pym/portage/util/_async/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 855c8761f85323bbe570ae61e87c57dc8ea5ea0e X-VCS-Branch: master Date: Wed, 8 Feb 2017 09:39:55 +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: c7d55b08-e7ec-42ac-9f95-c9e10e0005d0 X-Archives-Hash: 1c64183040d704778f99a9bd7d504c3f commit: 855c8761f85323bbe570ae61e87c57dc8ea5ea0e Author: Zac Medico gentoo org> AuthorDate: Wed Feb 8 09:08:07 2017 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Feb 8 09:10:49 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=855c8761 PopenProcess: suppress ResourceWarning subprocess "still running" (bug 608594) Override the _set_returncode method to set the Popen.returncode attribute, in order to suppress Python 3.6 ResourceWarnings which erroneously report that the subprocess is still running. X-Gentoo-Bug: 608594 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=608594 pym/portage/util/_async/PopenProcess.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pym/portage/util/_async/PopenProcess.py b/pym/portage/util/_async/PopenProcess.py index 2fc56d295..4344b1c9d 100644 --- a/pym/portage/util/_async/PopenProcess.py +++ b/pym/portage/util/_async/PopenProcess.py @@ -1,4 +1,4 @@ -# Copyright 2012 Gentoo Foundation +# Copyright 2012-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.SubProcess import SubProcess @@ -31,3 +31,10 @@ class PopenProcess(SubProcess): self._reg_id = None self._waitpid_cb(pid, condition) self.wait() + + def _set_returncode(self, wait_retval): + SubProcess._set_returncode(self, wait_retval) + if self.proc.returncode is None: + # Suppress warning messages like this: + # ResourceWarning: subprocess 1234 is still running + self.proc.returncode = self.returncode