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 EAFAC138330 for ; Wed, 14 Sep 2016 21:39:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D11C5E0AA9; Wed, 14 Sep 2016 21:39:17 +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 0DE2AE0AA9 for ; Wed, 14 Sep 2016 21:39:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 F3543340906 for ; Wed, 14 Sep 2016 21:39:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4CAC5247C for ; Wed, 14 Sep 2016 21:39:14 +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: <1473889144.298bd98dabaa92e85a57795fa37ef47d3379092d.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/package/ebuild/config.py X-VCS-Directories: pym/portage/package/ebuild/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 298bd98dabaa92e85a57795fa37ef47d3379092d X-VCS-Branch: master Date: Wed, 14 Sep 2016 21:39:14 +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: 55494105-3a1f-4504-8620-edf5f667a428 X-Archives-Hash: bdf4e379359b84d6355e1f58d0d89ce1 commit: 298bd98dabaa92e85a57795fa37ef47d3379092d Author: Zac Medico gentoo org> AuthorDate: Wed Sep 7 22:38:49 2016 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Sep 14 21:39:04 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=298bd98d config.setcpv: add recursion assertion pym/portage/package/ebuild/config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 7de4df7..505c7a2 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1372,6 +1372,21 @@ class config(object): return value + def _setcpv_recursion_gate(f): + """ + Raise AssertionError for recursive setcpv calls. + """ + def wrapper(self, *args, **kwargs): + if hasattr(self, '_setcpv_active'): + raise AssertionError('setcpv recursion detected') + self._setcpv_active = True + try: + return f(self, *args, **kwargs) + finally: + del self._setcpv_active + return wrapper + + @_setcpv_recursion_gate def setcpv(self, mycpv, use_cache=None, mydb=None): """ Load a particular CPV into the config, this lets us see the