]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Improve compatibility with Python3.0 testsuite
authorJesus Cea <jcea@jcea.es>
Tue, 2 Sep 2008 02:29:06 +0000 (02:29 +0000)
committerJesus Cea <jcea@jcea.es>
Tue, 2 Sep 2008 02:29:06 +0000 (02:29 +0000)
Lib/bsddb/__init__.py
Lib/bsddb/test/test_all.py
Modules/bsddb.h

index 0b8f6d95d5d1070c12a292b556621cce4667539f..0e5169cbc4fdd78a783c7adc6d51b10676a0f2ee 100644 (file)
@@ -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()
index 75f5dc04f14edea1fcad49788a9ccae388783ebf..75a232299892917926f84a718e84a56c9c0fd793 100644 (file)
@@ -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)
index 41f1db9ad24c4857f39cc6add27391db9147fd69..af5e56b570bbf8374c15f1528e8a4d83349b8c4d 100644 (file)
 #error "eek! DBVER can't handle minor versions > 9"
 #endif
 
-#define PY_BSDDB_VERSION "4.7.3pre2"
+#define PY_BSDDB_VERSION "4.7.3pre3"
 
 /* Python object definitions */