]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Link to state, not object, for mutable extension
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 9 Mar 2021 15:48:59 +0000 (10:48 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 9 Mar 2021 16:13:16 +0000 (11:13 -0500)
commit1031fc6f781a3a6088467791e837f23a4b338aef
tree1ed3cf02629ac9f7e38016d467ed2f95257f3e06
parent85c843bcc3ea1ca16be06fe85b03d99c4e519f3d
Link to state, not object, for mutable extension

The ``sqlalchemy.ext.mutable`` extension now tracks the "parents"
collection using the :class:`.InstanceState` associated with objects,
rather than the object itself. The latter approach required that the object
be hashable so that it can be inside of a ``WeakKeyDictionary``, which goes
against the behavioral contract of the ORM overall which is that ORM mapped
objects do not need to provide any particular kind of ``__hash__()`` method
and that unhashable objects are supported.

Fixes: #6020
Change-Id: I414c8861bc5691f5f320dac3eb696f4b8c37d347
doc/build/changelog/unreleased_14/6020.rst [new file with mode: 0644]
lib/sqlalchemy/ext/mutable.py
test/ext/test_mutable.py