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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 78D24158089 for ; Sun, 15 Oct 2023 22:02:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CA7E42BC014; Sun, 15 Oct 2023 22:02:52 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AD34C2BC014 for ; Sun, 15 Oct 2023 22:02:52 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A8ED4335CCD for ; Sun, 15 Oct 2023 22:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F36C895E for ; Sun, 15 Oct 2023 22:02:49 +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: <1697405888.3e38ae92bdd5b057352a2bcb044fb587b15b25f3.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/dbapi/_MergeProcess.py X-VCS-Directories: lib/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 3e38ae92bdd5b057352a2bcb044fb587b15b25f3 X-VCS-Branch: master Date: Sun, 15 Oct 2023 22:02:49 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 83a12830-4b8e-4772-801f-ad8e21463674 X-Archives-Hash: 63b6a19f09431709d6ca421c821ec739 commit: 3e38ae92bdd5b057352a2bcb044fb587b15b25f3 Author: Zac Medico gentoo org> AuthorDate: Sun Oct 15 19:21:44 2023 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Oct 15 21:38:08 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3e38ae92 MergeProcess: Eliminate target arguments that reference self This improves compatibility with the multiprocessing spawn start method, by eliminating this error: AttributeError: Can't pickle local object 'MergeProcess._start..' Bug: https://bugs.gentoo.org/914876 Signed-off-by: Zac Medico gentoo.org> lib/portage/dbapi/_MergeProcess.py | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/portage/dbapi/_MergeProcess.py b/lib/portage/dbapi/_MergeProcess.py index 012435dce3..c1085270da 100644 --- a/lib/portage/dbapi/_MergeProcess.py +++ b/lib/portage/dbapi/_MergeProcess.py @@ -74,20 +74,6 @@ class MergeProcess(ForkProcess): self.fd_pipes.setdefault(0, portage._get_stdin().fileno()) self.log_filter_file = self.settings.get("PORTAGE_LOG_FILTER_FILE_CMD") - self.target = functools.partial( - self._target, - lambda: self._counter, - lambda: self._elog_reader_fd, - lambda: self._dblink, - self.infloc, - self.mydbapi, - self.myebuild, - self.pkgloc, - self.prev_mtimes, - self.settings, - self.unmerge, - self.vartree.dbapi, - ) super()._start() def _lock_vdb(self): @@ -195,6 +181,22 @@ class MergeProcess(ForkProcess): self._dblink = mylink self._elog_reader_fd = elog_reader_fd + + self.target = functools.partial( + self._target, + self._counter, + self._elog_reader_fd, + self._dblink, + self.infloc, + self.mydbapi, + self.myebuild, + self.pkgloc, + self.prev_mtimes, + self.settings, + self.unmerge, + self.vartree.dbapi, + ) + pids = super()._spawn(args, fd_pipes, **kwargs) os.close(elog_writer_fd) mtime_writer.close() @@ -214,9 +216,9 @@ class MergeProcess(ForkProcess): @staticmethod def _target( - get_counter, - get_elog_reader_fd, - get_mylink, + counter, + elog_reader_fd, + mylink, infloc, mydbapi, myebuild, @@ -229,9 +231,7 @@ class MergeProcess(ForkProcess): """ TODO: Make all arguments picklable for the multiprocessing spawn start method. """ - os.close(get_elog_reader_fd()) - counter = get_counter() - mylink = get_mylink() + os.close(elog_reader_fd) portage.output.havecolor = not no_color(settings) # Avoid wastful updates of the vdb cache. vardb._flush_cache_enabled = False