Gentoo Archives: gentoo-commits

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