Skip to content

Commit

Permalink
T198705 unbound local error (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktordick authored Jun 16, 2020
1 parent 86e4607 commit 4bb29e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

2.4.7.dev1+perfact.3
--------------------

Bugfix for `UnboundLocalError` in Python 3

2.4.7.dev1+perfact.2
--------------------

Expand Down
2 changes: 1 addition & 1 deletion Products/ZPsycopgDA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# their work without bothering about the module dependencies.

__doc__ = "ZPsycopg Database Adapter Registration."
__version__ = '2.4.7.dev1+perfact.2'
__version__ = '2.4.7.dev1+perfact.3'

# Python2 backward compatibility
try:
Expand Down
4 changes: 3 additions & 1 deletion Products/ZPsycopgDA/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,12 @@ def query(self, query_string, max_rows=None, query_data=None):
self._register()
self.calls = self.calls+1

error = None
for retry in range(2):
try:
return self.query_inner(query_string, max_rows, query_data)
except Exception as err:
error = err
conn = self.getconn()
# First query in transaction yields a connection error - try to
# simply reconnect
Expand All @@ -405,7 +407,7 @@ def query(self, query_string, max_rows=None, query_data=None):
break

# We only reach this if another error occured
self.handle_retry(err)
self.handle_retry(error)
self._abort()

# Taint this transaction
Expand Down

0 comments on commit 4bb29e9

Please sign in to comment.