mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Update bsddb code to version 4.7.3pre2. This code should
be compatible with Python 3.0, also. http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3
This commit is contained in:
parent
82358691f7
commit
4907d27c1f
27 changed files with 1020 additions and 447 deletions
|
@ -4,19 +4,8 @@
|
|||
import os
|
||||
import unittest
|
||||
|
||||
try:
|
||||
# For Pythons w/distutils pybsddb
|
||||
from bsddb3 import db
|
||||
except ImportError:
|
||||
# For Python 2.3
|
||||
from bsddb import db
|
||||
|
||||
from test_all import get_new_environment_path, get_new_database_path
|
||||
|
||||
try:
|
||||
from bsddb3 import test_support
|
||||
except ImportError:
|
||||
from test import test_support
|
||||
from test_all import db, test_support, get_new_environment_path, \
|
||||
get_new_database_path
|
||||
|
||||
try :
|
||||
a=set()
|
||||
|
@ -79,12 +68,16 @@ class DBTxn_distributed(unittest.TestCase):
|
|||
|
||||
def test01_distributed_transactions(self) :
|
||||
txns=set()
|
||||
adapt = lambda x : x
|
||||
import sys
|
||||
if sys.version_info[0] >= 3 :
|
||||
adapt = lambda x : bytes(x, "ascii")
|
||||
# Create transactions, "prepare" them, and
|
||||
# let them be garbage collected.
|
||||
for i in xrange(self.num_txns) :
|
||||
txn=self.dbenv.txn_begin()
|
||||
gid="%%%dd" %db.DB_XIDDATASIZE
|
||||
gid=gid %i
|
||||
txn = self.dbenv.txn_begin()
|
||||
gid = "%%%dd" %db.DB_XIDDATASIZE
|
||||
gid = adapt(gid %i)
|
||||
self.db.put(i, gid, txn=txn, flags=db.DB_APPEND)
|
||||
txns.add(gid)
|
||||
txn.prepare(gid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue