diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-18 16:08:19 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-18 16:08:19 -0500 |
commit | 3209a73b92e17dd351a50c41352791baeefcd846 (patch) | |
tree | 2598487e5032baa9847fa11fbe9b34ee64596f7e /lib/sqlalchemy/orm/session.py | |
parent | 3eff76c4b0c234717e6d8a157ef6883b72694927 (diff) | |
download | sqlalchemy-3209a73b92e17dd351a50c41352791baeefcd846.tar.gz |
- Mapped state internals have been reworked to allow for a 50% reduction
in callcounts specific to the "expiration" of objects, as in
the "auto expire" feature of :meth:`.Session.commit` and
for :meth:`.Session.expire_all`, as well as in the "cleanup" step
which occurs when object states are garbage collected.
fixes #3307
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 3df6dce7a..c47026969 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -2691,9 +2691,13 @@ def make_transient(instance): if s: s._expunge_state(state) - # remove expired state and - # deferred callables - state.callables.clear() + # remove expired state + state.expired_attributes.clear() + + # remove deferred callables + if state.callables: + del state.callables + if state.key: del state.key if state.deleted: |