]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Call __del() before remove()
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Dec 2018 03:10:45 +0000 (22:10 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Dec 2018 13:37:03 +0000 (08:37 -0500)
commit07cea66ccb74c68fa505b5fbba91984e0375993d
tree9b62f3292aa727763ccc326f000cefb9692adb63
parentec5c9ebe6e7b8822de0c7bd19aea11ea2a582e29
Call __del() before remove()

The "remove" event for collections is now called before the item is removed
in the case of the ``collection.remove()`` method, as is consistent with the
behavior for most other forms of collection item removal (such as
``__delitem__``, replacement under ``__setitem__``).  The ``pop()`` methods
are now the only exception as the target item is not available until after
the pop operation proceeds.

This allows ``remove()`` to be consistent in its behavior with all
the other collection operations, allows the "before_delete" hook
to be local to "pop()" operations only, and removes some method overhead.

We are also looking here to gain some more predictability in terms
of the fix for #1103.

Change-Id: I4fdea911517d65cc300fae0e9c351a471e52e4ab
doc/build/changelog/unreleased_13/attr_remove.rst [new file with mode: 0644]
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/collections.py
test/orm/test_attributes.py
test/orm/test_hasparent.py
test/profiles.txt