]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Ensure strong ref to obj before calling persistent_to_deleted, others
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 3 Oct 2016 16:25:42 +0000 (12:25 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 3 Oct 2016 16:25:42 +0000 (12:25 -0400)
commit728ce8cc480d0ada690e5a97067cff821b9a65f3
treec9e12ecd610b87c40d2ce1ba1cdd4b61d2d33a15
parent333414fe94941a6a58e7d8e45042548eb2d58119
Ensure strong ref to obj before calling persistent_to_deleted, others

Add checks in spots where state.obj() might be late-GC'ed before
we get a chance to call the event.   There may be more cases
of these which we should address as they come up.  The Session
should always be maintaining strong refs to objects that have
pending operations left on them, so for these cases we need
to ensure that ref remains long enough for the event to be called.

Change-Id: I1a7c7bc57130acc11f54ad55924af2e36ac75101
Fixes: #3808
doc/build/changelog/changelog_11.rst
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/state.py
test/orm/test_events.py