diff options
author | Jesus Cea <jcea@jcea.es> | 2008-09-02 02:30:21 (GMT) |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2008-09-02 02:30:21 (GMT) |
commit | 3a2bd7d5c5c4af6e7916823d107e524c7f5aaa5a (patch) | |
tree | 793a7bb68ae1bf4707665bc59ca948b39f76be11 /Lib/bsddb | |
parent | 3e4f055602496a7388058b4d5020b27d9ac7bd4b (diff) | |
download | cpython-3a2bd7d5c5c4af6e7916823d107e524c7f5aaa5a.zip cpython-3a2bd7d5c5c4af6e7916823d107e524c7f5aaa5a.tar.gz cpython-3a2bd7d5c5c4af6e7916823d107e524c7f5aaa5a.tar.bz2 |
Improve compatibility with Python3.0 testsuite
Diffstat (limited to 'Lib/bsddb')
-rw-r--r-- | Lib/bsddb/__init__.py | 15 | ||||
-rw-r--r-- | Lib/bsddb/test/test_all.py | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py index d483139..5dea0f8 100644 --- a/Lib/bsddb/__init__.py +++ b/Lib/bsddb/__init__.py @@ -110,7 +110,7 @@ class _iter_mixin(MutableMapping): key = _DeadlockWrap(cur.first, 0,0,0)[0] yield key - next = cur.__next__ + next = getattr(cur, "next") while 1: try: key = _DeadlockWrap(next, 0,0,0)[0] @@ -123,7 +123,7 @@ class _iter_mixin(MutableMapping): # FIXME-20031101-greg: race condition. cursor could # be closed by another thread before this call. _DeadlockWrap(cur.set, key,0,0,0) - next = cur.__next__ + next = getattr(cur, "next") except _bsddb.DBNotFoundError: pass except _bsddb.DBCursorClosedError: @@ -152,7 +152,7 @@ class _iter_mixin(MutableMapping): key = kv[0] yield kv - next = cur.__next__ + next = getattr(cur, "next") while 1: try: kv = _DeadlockWrap(next) @@ -166,7 +166,7 @@ class _iter_mixin(MutableMapping): # FIXME-20031101-greg: race condition. cursor could # be closed by another thread before this call. _DeadlockWrap(cur.set, key,0,0,0) - next = cur.__next__ + next = getattr(cur, "next") except _bsddb.DBNotFoundError: pass except _bsddb.DBCursorClosedError: @@ -302,12 +302,15 @@ class _DBWithCursor(_iter_mixin): self._checkCursor() return _DeadlockWrap(self.dbc.set_range, key) - def __next__(self): + def __next__(self): # Renamed by "2to3" self._checkOpen() self._checkCursor() - rv = _DeadlockWrap(self.dbc.__next__) + rv = _DeadlockWrap(getattr(self.dbc, "next")) return rv + if sys.version_info[0] >= 3 : # For "2to3" conversion + next = __next__ + def previous(self): self._checkOpen() self._checkCursor() diff --git a/Lib/bsddb/test/test_all.py b/Lib/bsddb/test/test_all.py index d49c429..9a4d3ee 100644 --- a/Lib/bsddb/test/test_all.py +++ b/Lib/bsddb/test/test_all.py @@ -33,6 +33,8 @@ if sys.version_info[0] >= 3 : v = getattr(self._dbcursor, "next")() return self._fix(v) + next = __next__ + def previous(self) : v = self._dbcursor.previous() return self._fix(v) |