]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Establish the fixed set of loader path tokens up front
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Aug 2026 13:08:00 +0000 (09:08 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 11 Aug 2026 14:23:39 +0000 (10:23 -0400)
commit74f0734d1624bf6d587c69557005b5a728574fbf
tree211ab60146bcb92dd357b1dcff981f57d4c04d83
parent5995834ee06fc5cae45f86992d778fd5357c08ee
Establish the fixed set of loader path tokens up front

Fixed issue where unpickling an ORM object that were loaded using
loader options making use of wildcard tokens, such as
:func:`_orm.load_only` or :func:`_orm.raiseload` with ``"*"``, would
fail with ``KeyError`` or ``IndexError`` if the process doing the
unpickling had not yet constructed a loader path making use of that
same token.  This would typically be observed when the object were
unpickled in a separate process, such as with the ``spawn`` or
``forkserver`` multiprocessing start methods, the latter of which
became the default on POSIX platforms as of Python 3.14.  The internal
collection of these tokens is now established up front, so that it is
identical in every process.

Fixed issue where a string ending in ``"*"`` passed to a
:class:`_orm.Load` strategy method, such as
``Load(A).joinedload("bs.*")``, would bypass the check which rejects
string attribute names in loader options, silently producing a loader
path that matched nothing.  Such a string now raises
:class:`.ArgumentError` with the same message given for any other
string attribute name.  The bare wildcard ``"*"``, as in
``Load(A).lazyload("*")``, continues to be accepted.

Fixes: #13493
Change-Id: I0e8ddf4168bbea132392dd2dfda9a1ef0daf6436
12 files changed:
doc/build/changelog/unreleased_20/13493.rst [new file with mode: 0644]
lib/sqlalchemy/orm/path_registry.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/strategy_options.py
lib/sqlalchemy/testing/__init__.py
lib/sqlalchemy/testing/util.py
test/orm/test_options.py
test/orm/test_pickled.py
test/orm/test_utils.py
test/sql/test_resultset.py
test/sql/test_types.py