]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
dont produce side effects for do_orm_execute
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 22 May 2026 20:01:10 +0000 (16:01 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 24 May 2026 15:22:40 +0000 (11:22 -0400)
commit9030af40baffdd68e214434ef9a89bf4b117f99b
treeed6a9dab7c0c07d830633749eff7cc3b2919ef34
parent9c31086f96927fbc3379a2d659af06e2ef7a2784
dont produce side effects for do_orm_execute

Fixed issue where the presence of a :meth:`.SessionEvents.do_orm_execute`
event hook would cause internal execution options such as ``yield_per`` and
loader-specific state from the first ``orm_pre_session_exec`` pass to leak
into the second pass, leading to errors when using relationship loaders
such as :func:`.selectinload` and :func:`.immediateload`.  The execution
options passed to the second compilation pass are now based on the original
options plus only the explicit updates made via
:meth:`.ORMExecuteState.update_execution_options` within the event hook.

Fixes: #13301
Change-Id: Ide64d7202102930b68a2ab903054d538cd2f99dd
doc/build/changelog/unreleased_20/13301.rst [new file with mode: 0644]
lib/sqlalchemy/orm/session.py
test/aaa_profiling/test_memusage.py
test/orm/test_events.py