Support linking of the bsddb module against BerkeleyDB 4.5.x
[python.git] / Lib / bsddb / test / test_1413192.py
blob436f407867d6a7f517446da9f6da8df6e3b793ce
2 # http://python.org/sf/1413192
4 # This test relies on the variable names, see the bug report for details.
5 # The problem was that the env was deallocated prior to the txn.
7 try:
8 # For Pythons w/distutils and add-on pybsddb
9 from bsddb3 import db
10 except ImportError:
11 # For Python >= 2.3 builtin bsddb distribution
12 from bsddb import db
14 env_name = '.'
16 env = db.DBEnv()
17 env.open(env_name, db.DB_CREATE | db.DB_INIT_TXN | db.DB_INIT_MPOOL)
18 the_txn = env.txn_begin()
20 map = db.DB(env)
21 map.open('xxx.db', "p", db.DB_HASH, db.DB_CREATE, 0666, txn=the_txn)