Commit Graph

73 Commits

Author SHA1 Message Date
Tim Peters 0ebf27aad9 BaseThreadedTestCase.setup(): stop special-casing WindowsError.
Rev 45964 fiddled with WindowsError, and broke test_bsddb3 on all
the Windows buildbot slaves as a result.  This should repair it.
2006-05-11 16:37:42 +00:00
Martin v. Löwis e93abb7ca6 Handle ERROR_ALREADY_EXISTS. 2006-05-06 20:04:08 +00:00
Gregory P. Smith 64029986bc Fixes bug #1117761
bsddb.*open() methods cachesize parameter wouldn't work (raised an
internal bsddb.db exception when it was given).  The set_cachesize
call needed to be moved from the DB object to the DBEnv since the env
was introduced to allow for threading.

(will backport to 2.4)
2006-04-12 20:35:02 +00:00
Gregory P. Smith 14c6b4626f Closes bug #1149413
Using None for a filename with the 'n' flag when calling bsddb.btopen
would cause an error while checking if the file None existed.  error
not likely to be seen as anyone using None for a filename would likely
use the 'c' flag in the first place.
2006-04-12 20:16:56 +00:00
Gregory P. Smith 7f5b6f4b33 Fix bsddb.db.DBError derived exceptions so they can be unpickled.
Also adds some backwards compatibility when compiling _bsddb.c on earlier
python versions (needed for pybsddb).
2006-04-08 07:10:51 +00:00
Thomas Wouters 318af47512 Plug the last 657 referenceleaks in test_bsddb3: a circular reference
between a TestCase instance, the database it opened (or a cursor to a
database) and a bound method as a registered database callback, and a lack
of GC-handling in bsddb caused the TestCases to linger. Fix the test, for
now, as backward compatibility makes adding GC to bsddb annoying.
2006-03-12 00:13:09 +00:00
Tim Peters 32cbc96150 Whitespace normalization. 2006-02-20 21:42:18 +00:00
Georg Brandl a223d2cb29 Bug #1210377: close bsddb cursor correctly after NotFoundError. 2006-02-20 20:29:52 +00:00
Georg Brandl 19e2203fff Add a unit test for bug fix #1396678. 2006-02-19 01:21:11 +00:00
Georg Brandl 26caeba35a Bug #1396678: a closed bsddb.DB raises AttributeError on repr().
It now returns "{}". Is that the correct solution?
2006-02-19 00:53:54 +00:00
Gregory P. Smith c26cf5a6f1 fix test import for use in standalone pybsddb project bsddb3 module as well
as python builtin bsddb.
2006-01-29 23:54:38 +00:00
Gregory P. Smith 3d344e8b07 Add wrapper for DBEnv.set_tx_timeout method to allow time based DB_RECOVER
(test cases and dbobj wrapping)
2006-01-27 07:06:15 +00:00
Neal Norwitz 62a21121b4 Fix bug #1413192, fix seg fault in bsddb if a txn was deleted before the env.
Will backport.
2006-01-25 05:21:55 +00:00
Neal Norwitz 40563eddf1 Get BSD DB working most for version 3.2 2005-10-20 04:36:08 +00:00
Gregory P. Smith 6564ca72ad fix import to work with either module name. 2005-06-09 07:11:42 +00:00
Anthony Baxter 95a2a4ea70 Tools/scripts/reindent.py _is_ your friend 2005-06-08 04:35:50 +00:00
Gregory P. Smith 7e87a8a0be fix more Errors (not Failures) when run using BerkeleyDB <= 4.0 2005-06-06 18:12:24 +00:00
Gregory P. Smith c9321ccdfc fix Errors (not Failures) in test cases when running with BerkeleyDB<4.2 2005-06-06 17:59:00 +00:00
Gregory P. Smith 889bca0df1 make the tests that expect uncatchable exceptions from a callback test
for them in a roundabout way (catching and parsing stderr)

keeps test output clean.
2005-06-06 17:30:22 +00:00
Gregory P. Smith 9e28205502 test case for pybsddb SF bug id 1215432 2005-06-06 10:26:25 +00:00
Gregory P. Smith 48796c3241 test DB.associate using transactions. somewhat related to SF pybsddb
bug #1215432
2005-06-06 09:52:10 +00:00
Gregory P. Smith e947706b10 pybsddb 4.3.2:
* the has_key() method was not raising a DBError when a database error
   had occurred. [SF patch id 1212590]
 * added a wrapper for the DBEnv.set_lg_regionmax method [SF patch id 1212590]
 * DBKeyEmptyError now derives from KeyError just like DBNotFoundError.
 * internally everywhere DB_NOTFOUND was checked for has been updated
   to also check for DB_KEYEMPTY.  This fixes the semantics of a couple
   operations on recno and queue databases to be more intuitive and results
   in less unexpected DBKeyEmptyError exceptions being raised.
2005-06-04 06:46:59 +00:00
Tim Peters 5d36a55eaa Whitespace normalization. 2005-06-03 22:40:27 +00:00
Gregory P. Smith e4ed2de260 pybsddb 4.3.1, adds support for DB.set_bt_compare database btree comparison
functions written in python.

contributed by <frederic.gobry@epfl.ch>
2005-06-03 07:03:07 +00:00
Martin v. Löwis e869eb1953 Patch #1112812: Make bsddb/__init__.py more friendly for modulefinder.
Backported to 2.4.
2005-03-03 09:46:07 +00:00
Steve Holden 69b8caa23a Simplify string comparison using startswith() 2005-02-02 18:47:18 +00:00
Tim Peters 95334a5d1e Purged Berkeley code of references to the long-obsolete whrandom. 2004-08-08 00:54:21 +00:00
Tim Peters 182b5aca27 Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
Gregory P. Smith 19699a9351 Adds support for DB.pget and DBCursor.pget methods.
Based on a patch supplied by Ian Ward <ian@arevco.ca> on the pybsddb
mailing list 2004-03-26.
2004-06-28 04:06:49 +00:00
Gregory P. Smith dc5af70631 SF patch / bug #967763
Fix memory leaks revealed by valgrind and ensuing code inspection.

In the existing test suite valgrind revealed two memory leaks (DB_get
and DBC_set_range).  Code inspection revealed that there were many other
potential similar leaks (many on odd code error paths such as passing
something other than a DBTxn object for a txn= parameter or in the face
of an out of memory error).  The most common case that would cause a
leak was when using recno or queue format databases with integer keys,
sometimes only with an exception exit.
2004-06-27 23:32:34 +00:00
Gregory P. Smith a6b3caad41 Fix SF bug # 897820 - we can no longer use the DB_TRUNCATE flag when
opening the DB to implement legacy interface flag='n' support as
BerkeleyDB 4.2.52 no longer allows it in transaction protected
environments.  Do the os.unlink ourselves.
2004-06-27 22:56:42 +00:00
Gregory P. Smith 1281f76606 * supply a more useful error message when append() is called on the
wrong type of database in dbshelve.
* fix a typo in the exception name when checking args
2004-03-16 18:50:26 +00:00
Gregory P. Smith bce64ec086 bugfix for people executing test_all to run the test suite. (call the
correct function)
2004-03-16 07:07:06 +00:00
Gregory P. Smith a7befda8d8 Fixes SF bug # 778421
* Fixed a bug in the compatibility interface set_location() method
   where it would not properly search to the next nearest key when
   used on BTree databases.  [SF bug id 788421]
 * Fixed a bug in the compatibility interface set_location() method
   where it could crash when looking up keys in a hash or recno
   format database due to an incorrect free().
2004-02-26 10:07:14 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Gregory P. Smith e33aef7b15 __init__.py: keep it compatible with older python (True and False == 1 and 0)
test_basics.py: updated for the set_get_returns_none() default of 2 change.
2004-01-13 19:59:57 +00:00
Gregory P. Smith a703a21b48 * Use weakref's of DBCursor objects for the iterator cursors to avoid a
memory leak that would've occurred for all iterators that were
  destroyed before having iterated until they raised StopIteration.

* Simplify some code.

* Add new test cases to check for the memleak and ensure that mixing
  iteration with modification of the values for existing keys works.
2003-11-03 01:04:41 +00:00
Gregory P. Smith dc113a8a06 * Fix the singlethreaded deadlocks occurring in the simple bsddb interface.
* Add support for multiple iterator/generator objects at once on the simple
  bsddb _DBWithCursor interface.
2003-11-02 09:10:16 +00:00
Gregory P. Smith be0db8b125 bsddb3 4.2.2, adds DBCursor.get_current_size() method to return the length
of the current value without reading the value itself.
2003-10-01 06:48:51 +00:00
Gregory P. Smith 1eb41e22ab Use a threadsafe private DBEnv for each bsddb compatibility interface
db that is opened.  DB_THREAD and DB_INIT_LOCK allow for multithreaded
access.  DB_PRIVATE prevents the DBEnv from using the filesystem
(making it only usable by this process; and in this implementation
using one DBEnv per bsddb database)
2003-09-27 23:00:19 +00:00
Gregory P. Smith 41631e8f66 Adds basic support for BerkeleyDB 4.2.x. Compiles and passes tests; new
features in BerkeleyDB not exposed.  notably: the DB_MPOOLFILE interface
has not yet been wrapped in an object.

Adds support for building and installing bsddb3 in python2.3 that has
an older version of this module installed as bsddb without conflicts.
The pybsddb.sf.net build/packaged version of the module uses a
dynamicly loadable module called _pybsddb rather than _bsddb.
2003-09-21 00:08:14 +00:00
Gregory P. Smith cec1b3f6a7 Maintain backwards compatibility with python < 2.3 by dynamically
adding the iterator interface for python >= 2.3.
2003-09-20 23:51:34 +00:00
Raymond Hettinger 2e9da6020e The previous change works much faster (one lookup per key) when
iteritems() is defined.
2003-09-13 03:18:34 +00:00
Raymond Hettinger deadbf50e4 SF #662923
Add support for the iterator and mapping protocols.
For Py2.3, this was done for shelve, dumbdbm and other mapping objects, but
not for bsddb and dbhash which were inadvertently missed.
2003-09-12 06:33:37 +00:00
Gregory P. Smith 6676f6edc1 Support DBEnv.set_shm_key() to allow multi-threaded multi-process
database environments to use shared memory on systems supporting it.
2003-08-28 21:50:30 +00:00
Barry Warsaw e3ea281280 readerThread(): Add max_retries to both DeadlockWrap() calls. This
may cause some tests to fail but it prevents them from hanging.
2003-07-21 23:01:34 +00:00
Barry Warsaw e676c5ef3e test01_join(): Fix a test failure when run with "python -O". The
setting of sCursor happened in an assert.
2003-07-21 18:43:33 +00:00
Gregory P. Smith ad30fa03a4 fix to work on python <= 2.1 2003-07-09 05:33:14 +00:00
Gregory P. Smith df35beed40 bugfix: proper import bsddb exists below 2003-07-09 05:29:24 +00:00
Gregory P. Smith 455d46f0d9 bsddb 4.1.6:
* Extended DB & DBEnv set_get_returns_none functionality to take a
   "level" instead of a boolean flag.  The boolean 0 and 1 values still
   have the same effect.  A value of 2 extends the "return None instead
   of raising an exception" behaviour to the DBCursor set methods.
   This will become the default behaviour in pybsddb 4.2.
 * Fixed a typo in DBCursor.join_item method that made it crash instead
   of returning a value.  Obviously nobody uses it.  Wrote a test case
   for join and join_item.
2003-07-09 04:45:59 +00:00