From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RyWLY-0004wF-Lo for garchives@archives.gentoo.org; Fri, 17 Feb 2012 22:32:08 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 61019E095C; Fri, 17 Feb 2012 22:31:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 2C8B1E095C for ; Fri, 17 Feb 2012 22:31:54 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 578E61B4008 for ; Fri, 17 Feb 2012 22:31:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 126FDE5400 for ; Fri, 17 Feb 2012 22:31:52 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1329517897.17f1186cb6788c8978b8d231393a03736edc2dfd.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/SlotObject.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 17f1186cb6788c8978b8d231393a03736edc2dfd X-VCS-Branch: master Date: Fri, 17 Feb 2012 22:31:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 5a073a73-b18e-44d6-9277-cfbe277e5899 X-Archives-Hash: 79f5ea3b0a0c604d89fb0efb72aff2bb commit: 17f1186cb6788c8978b8d231393a03736edc2dfd Author: Zac Medico gentoo org> AuthorDate: Fri Feb 17 22:31:37 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Feb 17 22:31:37 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D17f1186c SlotObject: validate __slots__ and keyword args --- pym/_emerge/SlotObject.py | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pym/_emerge/SlotObject.py b/pym/_emerge/SlotObject.py index fdc6f35..a59dfc1 100644 --- a/pym/_emerge/SlotObject.py +++ b/pym/_emerge/SlotObject.py @@ -1,4 +1,4 @@ -# Copyright 1999-2009 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 class SlotObject(object): @@ -15,9 +15,18 @@ class SlotObject(object): if not slots: continue for myattr in slots: - myvalue =3D kwargs.get(myattr, None) + myvalue =3D kwargs.pop(myattr, None) + if myvalue is None and getattr(self, myattr, None) is not None: + raise AssertionError( + "class '%s' duplicates '%s' value in __slots__ of base class '%s'"= % + (self.__class__.__name__, myattr, c.__name__)) setattr(self, myattr, myvalue) =20 + if kwargs: + raise TypeError( + "'%s' is an invalid keyword argument for this constructor" % + (next(iter(kwargs)),)) + def copy(self): """ Create a new instance and copy all attributes