]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Skip on slice assignment to self
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 19 Nov 2019 14:30:31 +0000 (09:30 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 20 Nov 2019 17:49:26 +0000 (12:49 -0500)
commit560044748a8ff5488769f8ebfa8a353a8d0115fa
tree43dc7c5f5127e263ce6b315a5c97f3daa96d5ec2
parent23b62c72ce436e32633f93c80a83db42bf5d60c7
Skip on slice assignment to self

Fixed issue where when assigning a collection to itself as a slice, the
mutation operation would fail as it would first erase the assigned
collection inadvertently.   As an assignment that does not change  the
contents should not generate events, the operation is now a no-op. Note
that the fix only applies to Python 3; in Python 2, the ``__setitem__``
hook isn't called in this case; ``__setslice__`` is used instead which
recreates the list item-by-item in all cases.

Fixes: #4990
Change-Id: I08727880f70f4fe188de53a4dcd36746b62c7233
doc/build/changelog/unreleased_13/4990.rst [new file with mode: 0644]
lib/sqlalchemy/orm/collections.py
test/orm/test_collection.py