]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Strong reference listen function wrapped by "once"
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 3 Aug 2019 03:20:06 +0000 (23:20 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 4 Aug 2019 16:40:24 +0000 (12:40 -0400)
commit63ac8595fd0c93edbb323ec42c9ceafa5db4b4a0
treee083595b9b08d032af83b1c5b655931bac0fe5ec
parentbe985bd41ecd0eeff90c1a817167a34eb02aeed1
Strong reference listen function wrapped by "once"

Fixed issue in event system where using the ``once=True`` flag with
dynamically generated listener functions would cause event registration of
future events to fail if those listener functions were garbage collected
after they were used, due to an assumption that a listened function is
strongly referenced.  The "once" wrapped is now modified to strongly
reference the inner function persistently, and documentation is updated
that using "once" does not imply automatic de-registration of listener
functions.

Fixes: #4794
Change-Id: I06388083d1633dcc89e8919eb1e51270f966df38
(cherry picked from commit e22d2b089fad1f79d53bc6238626f32f0e796ad0)
doc/build/changelog/unreleased_13/4794.rst [new file with mode: 0644]
lib/sqlalchemy/event/api.py
lib/sqlalchemy/util/langhelpers.py
test/base/test_events.py