]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix: make transaction status check account for pipeline mode 299/head
authorDenis Laxalde <denis.laxalde@dalibo.com>
Tue, 10 May 2022 10:11:21 +0000 (12:11 +0200)
committerDenis Laxalde <denis.laxalde@dalibo.com>
Tue, 10 May 2022 13:47:07 +0000 (15:47 +0200)
commit18d68824dbae96ec9362dac0bc1698022b484099
tree2696428bd179940e72bdcf93a77bc2a522540538
parentb80dbd5ee7a8e58958b4ce586a900176f7d67b0e
fix: make transaction status check account for pipeline mode

We turn _check_intrans() into a generator _check_intrans_gen() in order
to call _pipeline._sync_gen() if the connection is in pipeline mode so
as to retrieve an accurate connection status.

This makes the safety guard about 'autocommit' when inside a transaction
work in pipeline mode, thus removing the xfail in transaction tests.

In test_autocommit_unknown, we now catch OperationalError which is
raised by conn.wait() rather than ProgrammingError previously which is
no longer reached.
psycopg/psycopg/connection.py
psycopg/psycopg/connection_async.py
tests/test_connection.py
tests/test_connection_async.py
tests/test_transaction.py
tests/test_transaction_async.py