Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11467 - main/trunk/pym/portage/dbapi
Date: Sun, 24 Aug 2008 17:32:23
Message-Id: E1KXJRs-0000s1-LI@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-08-24 17:32:19 +0000 (Sun, 24 Aug 2008)
3 New Revision: 11467
4
5 Modified:
6 main/trunk/pym/portage/dbapi/vartree.py
7 Log:
8 * Fix broken _ObjectKey.__eq__() logic from previous commit.
9 * Define _ObjectKey.__slots__ to save memory.
10
11
12 Modified: main/trunk/pym/portage/dbapi/vartree.py
13 ===================================================================
14 --- main/trunk/pym/portage/dbapi/vartree.py 2008-08-24 17:21:47 UTC (rev 11466)
15 +++ main/trunk/pym/portage/dbapi/vartree.py 2008-08-24 17:32:19 UTC (rev 11467)
16 @@ -153,6 +153,8 @@
17
18 """Helper class used as _obj_properties keys for objects."""
19
20 + __slots__ = ("__weakref__", "_key")
21 +
22 def __init__(self, object):
23 """
24 This takes a path to an object.
25 @@ -167,9 +169,11 @@
26 return hash(self._key)
27
28 def __eq__(self, other):
29 - if not isinstance(other, self.__class__):
30 - return False
31 - return self._key == other._key
32 + if isinstance(other, self.__class__):
33 + other_key = other._key
34 + else:
35 + other_key = other
36 + return self._key == other_key
37
38 def _generate_object_key(self, object):
39 """