diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-10-02 02:02:51 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-10-02 02:02:51 +0000 |
| commit | abe17984fb608f62674737803ec0ea1012d5b176 (patch) | |
| tree | 83b8b10c9bd483de5734878f9c68281448e3e085 /lib/sqlalchemy/orm | |
| parent | 95bedd0badc7a9d1f22749bfcbb3286325d2be13 (diff) | |
| download | sqlalchemy-abe17984fb608f62674737803ec0ea1012d5b176.tar.gz | |
- identity_map._mutable_attrs is a plain dict since we manage weakref removal explicitly
- call list() around iteration of _mutable_attrs to guard against async gc.collect() while check_modified() is running
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/identity.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/identity.py b/lib/sqlalchemy/orm/identity.py index 6369d5a3c..423282161 100644 --- a/lib/sqlalchemy/orm/identity.py +++ b/lib/sqlalchemy/orm/identity.py @@ -12,7 +12,7 @@ from sqlalchemy.orm import attributes class IdentityMap(dict): def __init__(self): - self._mutable_attrs = weakref.WeakKeyDictionary() + self._mutable_attrs = {} self.modified = False def add(self, state): @@ -41,7 +41,7 @@ class IdentityMap(dict): """return True if any InstanceStates present have been marked as 'modified'.""" if not self.modified: - for state in self._mutable_attrs: + for state in list(self._mutable_attrs): if state.check_modified(): return True else: |
