summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-04-06 02:30:29 +1200
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-04-06 14:10:02 +1200
commit62743c3be1de686154c3c927f1d6df99e5203b39 (patch)
tree0e126cb17a4520b3a59b385c84df51d9fc5e7d0b /lib
parent2bee47efacd3c114fd93ce84880f91799b0b72af (diff)
downloadpsycopg2-fix-1073.tar.gz
Fixed copy() on DictRowfix-1073
Close #1073.
Diffstat (limited to 'lib')
-rw-r--r--lib/extras.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/extras.py b/lib/extras.py
index 85c1a44..ccb8b3f 100644
--- a/lib/extras.py
+++ b/lib/extras.py
@@ -196,6 +196,10 @@ class DictRow(list):
def __contains__(self, x):
return x in self._index
+ def __reduce__(self):
+ # this is apparently useless, but it fixes #1073
+ return super(DictRow, self).__reduce__()
+
def __getstate__(self):
return self[:], self._index.copy()
@@ -392,6 +396,7 @@ class NamedTupleCursor(_cursor):
def _cached_make_nt(cls, key):
return cls._do_make_nt(key)
+
# Exposed for testability, and if someone wants to monkeypatch to tweak
# the cache size.
NamedTupleCursor._cached_make_nt = classmethod(_cached_make_nt)
@@ -410,7 +415,8 @@ class LoggingConnection(_connection):
instance from the standard logging module.
"""
self._logobj = logobj
- if _logging and isinstance(logobj, (_logging.Logger, _logging.LoggerAdapter)):
+ if _logging and isinstance(
+ logobj, (_logging.Logger, _logging.LoggerAdapter)):
self.log = self._logtologger
else:
self.log = self._logtofile