Skip to content

Commit

Permalink
Support and require pg8000 >= 1.29
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Jun 27, 2023
1 parent d4dd433 commit 6100446
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def read_file(*path):
# postgresql
# pure-python
# pg8000
'pg8000 >= 1.11.0',
'pg8000 >= 1.29.0',
# CFFI, runs on all implementations.
# We get coverage from 3.x on Travis and verification it works on Windows from Travis.
# We get 2.7 testing from PyPy on Travis.
Expand Down
3 changes: 2 additions & 1 deletion src/relstorage/adapters/postgresql/drivers/pg8000.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ def connection_may_need_rollback(self, conn):
def connection_may_need_commit(self, conn):
if conn.readonly:
return False
return conn.in_transaction
# pg8000 1.29 changed in_transaction to _in_transaction
return conn._in_transaction

def _get_exception_pgcode(self, exc):
return exc.args[0]['C']
10 changes: 5 additions & 5 deletions src/relstorage/tests/locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def checkTL_ConflictingReadCurrent(self):
self.assertLessEqual(duration_blocking, commit_lock_timeout * multiplier)

@WithAndWithoutInterleaving
def checkTL_ReadCurrentConflict_DoesNotTakeExclusiveLocks(self):
def checkTL_ReadCurrentConflict_DoesNotTakeExclusiveLocks(self): # pylint:disable=too-many-locals
# Proves that if we try to check an old serial that has already moved on,
# we don't try taking exclusive locks at all.
from relstorage.adapters.interfaces import UnableToLockRowsToModifyError
Expand Down Expand Up @@ -411,7 +411,7 @@ def lock_shared(storage, notify=True):
read_current_oids = storage._tpc_phase.required_tids.keys()
if notify:
cond.acquire(5)
cond.notifyAll() # pylint:disable=deprecated-method
cond.notify_all()
cond.release()

try:
Expand All @@ -425,7 +425,7 @@ def lock_shared(storage, notify=True):
finally:
if notify:
cond.acquire(5)
cond.notifyAll() # pylint:disable=deprecated-method
cond.notify_all()
cond.release()


Expand Down Expand Up @@ -574,7 +574,7 @@ def checkTL_manualInterleavedConflictingReadCurrentDeadlock(self):
cond.storage_finished = None
def do_vote(storage, tx):
cond.acquire(5)
cond.notifyAll() # pylint:disable=deprecated-method
cond.notify_all()
cond.release()
try:
storage.tpc_vote(tx)
Expand All @@ -583,7 +583,7 @@ def do_vote(storage, tx):
finally:
cond.storage_finished = storage, tx
cond.acquire(5)
cond.notifyAll() # pylint:disable=deprecated-method
cond.notify_all()
cond.release()

thread_locking_b = threading.Thread(
Expand Down

0 comments on commit 6100446

Please sign in to comment.