]> 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:05:23 +0000 (19:05 +0100)
commita4ccaa22e5e4ada89b3e6d3f056f43237c4b6316
treef73e41fd6767b8c09be57c39e634b51050b566be
parent98935fb5c0a98edad6dee338718641305b8d0a4e
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
(cherry picked from commit d466d375889ee266ef928b6fbb6d673bda6beeb1)
doc/build/changelog/unreleased_20/13176.rst [new file with mode: 0644]
lib/sqlalchemy/orm/session.py
test/orm/test_session.py