summaryrefslogtreecommitdiffstats
path: root/pym/portage/util/_dyn_libs
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-14 18:56:39 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-14 18:56:39 -0700
commitdc36d802cc1eba7c3d818cebb77e947e930ec2ce (patch)
tree14cafaae8b01b155968e13d2796aee782ce3786c /pym/portage/util/_dyn_libs
parent461564ae94ff936918eeaa18493bc1da3846796f (diff)
downloadportage-dc36d802cc1eba7c3d818cebb77e947e930ec2ce.tar.gz
portage-dc36d802cc1eba7c3d818cebb77e947e930ec2ce.tar.bz2
portage-dc36d802cc1eba7c3d818cebb77e947e930ec2ce.zip
_LibGraphNode: re-use the _key attribute
This allows us to avoid repeating any previous stat calls, which helps to avoid potential race conditions due to inconsistent stat results when the file system is being modified concurrently.
Diffstat (limited to 'pym/portage/util/_dyn_libs')
-rw-r--r--pym/portage/util/_dyn_libs/LinkageMapELF.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
index fe86a7a89..fef75b62c 100644
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
@@ -60,7 +60,7 @@ class LinkageMapELF(object):
"""Helper class used as _obj_properties keys for objects."""
- __slots__ = ("__weakref__", "_key")
+ __slots__ = ("_key",)
def __init__(self, obj, root):
"""
@@ -135,8 +135,15 @@ class LinkageMapELF(object):
class _LibGraphNode(_ObjectKey):
__slots__ = ("alt_paths",)
- def __init__(self, obj, root):
- LinkageMapELF._ObjectKey.__init__(self, obj, root)
+ def __init__(self, key):
+ """
+ Create a _LibGraphNode from an existing _ObjectKey.
+ This re-uses the _key attribute in order to avoid repeating
+ any previous stat calls, which helps to avoid potential race
+ conditions due to inconsistent stat results when the
+ file system is being modified concurrently.
+ """
+ self._key = key._key
self.alt_paths = set()
def __str__(self):