summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-01-17 06:27:02 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-01-17 06:27:02 +0000
commit345eaeed74588d97fc614a396dd6cfe5f8ece938 (patch)
tree5982326823886bcd2f1ae4f4e62d283804127ff0 /lib/sqlalchemy/util.py
parentb58d6fe9d97cd458db4efb12609f829d5f7d5f9f (diff)
downloadsqlalchemy-345eaeed74588d97fc614a396dd6cfe5f8ece938.tar.gz
WeakCompositeKey was coded incorrectly and was not weakly referencing anything. However when repaired, the usage within RelationLoader._create_joins() still creates cycles between key elements and the value placed in the dict. In the interests of risk reduction, WCK is now removed and the two caches it was used for are now non-cached. Speed comparisons with one join/eager-heavy web application show no noticeable effect in response time.
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r--lib/sqlalchemy/util.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py
index 619888135..110ef21d5 100644
--- a/lib/sqlalchemy/util.py
+++ b/lib/sqlalchemy/util.py
@@ -1178,38 +1178,6 @@ class _TLocalRegistry(ScopedRegistry):
except AttributeError:
pass
-class WeakCompositeKey(object):
- """an weak-referencable, hashable collection which is strongly referenced
- until any one of its members is garbage collected.
-
- """
- keys = set()
-
- __slots__ = 'args', '__weakref__'
-
- def __init__(self, *args):
- self.args = [self.__ref(arg) for arg in args]
- WeakCompositeKey.keys.add(self)
-
- def __ref(self, arg):
- if isinstance(arg, type):
- return weakref.ref(arg, self.__remover)
- else:
- return lambda: arg
-
- def __remover(self, wr):
- WeakCompositeKey.keys.discard(self)
-
- def __hash__(self):
- return hash(tuple(self))
-
- def __cmp__(self, other):
- return cmp(tuple(self), tuple(other))
-
- def __iter__(self):
- return iter(arg() for arg in self.args)
-
-
class _symbol(object):
def __init__(self, name):
"""Construct a new named symbol."""