]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Restore object to the identity_map upon delete() unconditionally
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Oct 2016 13:51:50 +0000 (09:51 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Oct 2016 13:51:50 +0000 (09:51 -0400)
commite56a9d85acd165cfea08f9dc7e9d747054ce6fdb
tree9b4945ac54be816787e58f9fe8745ef56e0a7690
parent1f32d014da5d40406cd5d3996be5283c2fc57b26
Restore object to the identity_map upon delete() unconditionally

Fixed regression caused by :ticket:`2677` whereby calling
:meth:`.Session.delete` on an object that was already flushed as
deleted in that session would fail to set up the object in the
identity map (or reject the object), causing flush errors as the
object were in a state not accommodated by the unit of work.
The pre-1.1 behavior in this case has been restored, which is that
the object is put back into the identity map so that the DELETE
statement will be attempted again, which emits a warning that the number
of expected rows was not matched (unless the row were restored outside
of the session).

Change-Id: I9a8871f82cb1ebe67a7ad54d888d5ee835a9a40a
Fixes: #3839
doc/build/changelog/changelog_11.rst
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/unitofwork.py
test/orm/test_session.py
test/orm/test_unitofworkv2.py