]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
fix: Session.get() with with_for_update=False skips identity map
authorjoshuaswanson <joshuaswanson@users.noreply.github.com>
Fri, 27 Mar 2026 16:41:11 +0000 (12:41 -0400)
committerFederico Caselli <cfederico87@gmail.com>
Fri, 27 Mar 2026 18:03:38 +0000 (19:03 +0100)
commitd466d375889ee266ef928b6fbb6d673bda6beeb1
tree796a7cac0261d54e178e3cce7164b2418af96523
parenta49a4f021ad9c9ff69f5482881b00f831d523a22
fix: Session.get() with with_for_update=False skips identity map

Fixes #13176.

`Session.get()` checks `with_for_update is None` to decide whether to look up the identity map. Passing `with_for_update=False` fails this check and always hits the database, even though `ForUpdateArg._from_argument` already treats `False` and `None` identically (both return `None`). Changed to `with_for_update in (None, False)` to match.

Closes: #13199
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13199
Pull-request-sha: c639b8723888947317598df387c5e3e4d87acac4

Change-Id: I0584873f46099afadcdd760c0a267ae4d30528eb
doc/build/changelog/unreleased_20/13176.rst [new file with mode: 0644]
lib/sqlalchemy/orm/session.py
test/orm/test_session.py