diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-29 13:11:52 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-29 13:11:52 -0400 |
commit | 9d25eae8eec8c090339a01c03445bdf04a0840f5 (patch) | |
tree | d2184236c405081be62635264719b2971415adf9 /lib/sqlalchemy/orm/session.py | |
parent | a95b0a5b6e132e44bcc9cc4429526533ab964787 (diff) | |
download | sqlalchemy-9d25eae8eec8c090339a01c03445bdf04a0840f5.tar.gz |
- use a faster discard when loading
- don't do a bool on identity map since it calls __len__
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 036045dba..52873eb34 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1427,10 +1427,10 @@ class Session(_SessionClassMethods): if state.key is None: state.key = instance_key elif state.key != instance_key: - # primary key switch. use discard() in case another + # primary key switch. use safe_discard() in case another # state has already replaced this one in the identity # map (see test/orm/test_naturalpks.py ReversePKsTest) - self.identity_map.discard(state) + self.identity_map.safe_discard(state) if state in self.transaction._key_switches: orig_key = self.transaction._key_switches[state][0] else: |