]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
include rollback exception in closed transaction context manager error message
authorIlan Keshet <ilankeshet@gmail.com>
Wed, 8 Jul 2026 21:49:35 +0000 (17:49 -0400)
committerMichael Bayer <mike_mp@zzzcomputing.com>
Wed, 8 Jul 2026 23:03:15 +0000 (23:03 +0000)
commit6aaf1afe8e74c73694a63154d90baebbf63f47a0
tree63bb8ca51915002b76eea12dcbe19c588c942980
parent4009b58467c0f76d318a336894d754adb9ff4f74
include rollback exception in closed transaction context manager error message

Improved the error message raised when a Session is used inside a context
manager after the transaction has been rolled back due to an exception.
The InvalidRequestError now includes the original exception that triggered
the rollback, making it clearer why the transaction is no longer active.
Pull request courtesy Ilan Keshet.

Closes: #11297
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11297
Pull-request-sha: 9feb9658078e1acfbeed29a119c9765cf684f677

Change-Id: If4ee3e9f673adfec533726b9b4d5c125dfcf2b9c
doc/build/changelog/unreleased_21/11297.rst [new file with mode: 0644]
lib/sqlalchemy/engine/util.py
test/orm/test_transaction.py