]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Use a copy of `self.contents` in this list comprehension.
authorYilei Yang <yileiyang@google.com>
Thu, 21 Dec 2023 07:47:03 +0000 (02:47 -0500)
committerFederico Caselli <cfederico87@gmail.com>
Sat, 23 Dec 2023 19:00:31 +0000 (20:00 +0100)
commit4a5e41a2d1d550f341394d06fe392c879fa8faff
tree089f5f27666fe286866ea6e9056505db4cadb801
parent3776694bd7d3d3877e2e6f6ad259e490b2f672a9
Use a copy of `self.contents` in this list comprehension.

Improved a fix first implemented for :ticket:`3208` released in version
0.9.8, where the registry of classes used internally by declarative could
be subject to a race condition in the case where individual mapped classes
are being garbage collected at the same time while new mapped classes are
being constructed, as can happen in some test suite configurations or
dynamic class creation environments.   In addition to the weakref check
already added, the list of items being iterated is also copied first to
avoid "list changed while iterating" errors.  Pull request courtesy Yilei
Yang.

Fixes: #10782
Closes: #10783
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10783
Pull-request-sha: 354e97b640430120d0c193a4efe487f293d4768b

Change-Id: I04ccc92472bf1004dad0fb785e16b180f58f101d
(cherry picked from commit 0fe5d3ca51884b85b4059ed05b53f02172325e70)
doc/build/changelog/unreleased_14/10782.rst [new file with mode: 0644]
lib/sqlalchemy/orm/clsregistry.py