Commit Graph

83 Commits

Author SHA1 Message Date
Gregory P. Smith 6fed7937c6 fix: DB.stat flags and txn keyword arguments were backwards. 2006-09-30 06:05:07 +00:00
Neal Norwitz 5aa96895d8 Handle malloc and fopen failures more gracefully.
Klocwork 180-181
2006-08-13 18:11:43 +00:00
Gregory P. Smith 641cddf0fa - pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename
methods now allow their database parameter to be None as the
  sleepycat API allows.

Also adds an appropriate test case for DBEnv.dbrename and dbremove.
2006-07-28 01:35:25 +00:00
Neal Norwitz dce937f32c Ensure we don't write beyond errText. I think I got this right, but
it definitely could use some review to ensure I'm not off by one
and there's no possible overflow/wrap-around of bytes_left.
Reported by Klocwork #1.

Fix a problem if there is a failure allocating self->db.
Found with failmalloc.
2006-07-23 08:01:43 +00:00
Neal Norwitz e75cad6125 Fix memory leak reported by valgrind while running test_subprocess 2006-06-17 22:38:15 +00:00
Martin v. Löwis 70ee3ccd1e Get rid of function pointer cast. 2006-06-12 04:26:31 +00:00
Neal Norwitz 09a29fae8f Cleanup Py_ssize_t a little (get rid of second #ifdef) 2006-06-12 02:05:55 +00:00
Neal Norwitz b4fcf8d787 Fix Coverity # 146. newDBSequenceObject would deref dbobj, so it can't be NULL.
We know it's not NULL from the ParseTuple and DbObject_Check will verify
it's not NULL.
2006-06-11 05:44:18 +00:00
Tim Peters bb21b2c50c BSequence_set_range(): Rev 46688 ("Fix a bunch of
parameter strings") changed this function's signature
seemingly by mistake, which is causing buildbots to fail
test_bsddb3.  Restored the pre-46688 signature.
2006-06-06 15:50:17 +00:00
Neal Norwitz dd2a6bf14f Fix a bunch of parameter strings 2006-06-06 07:23:01 +00:00
Gregory P. Smith 3c228b19f0 - bsddb: the __len__ method of a DB object has been fixed to return correct
results.  It could previously incorrectly return 0 in some cases.
  Fixes SF bug 1493322 (pybsddb bug 1184012).
2006-06-05 23:59:37 +00:00
Gregory P. Smith 372b583a6b * fix DBCursor.pget() bug with keyword argument names when no data= is
supplied [SF pybsddb bug #1477863]
2006-06-05 18:48:21 +00:00
Gregory P. Smith f0547d0d3e * add support for DBSequence objects [patch #1466734] 2006-06-05 17:38:04 +00:00
Gregory P. Smith db8a80735b * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] 2006-06-05 01:56:15 +00:00
Gregory P. Smith 76a82e89ab * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] 2006-06-05 01:39:52 +00:00
Gregory P. Smith bad474544c fix a bug in the previous commit. don't leak empty list on error return and
fix the additional rare (out of memory only) bug that it was supposed to fix
of not freeing log_list when the python allocator failed.
2006-06-05 00:33:35 +00:00
Gregory P. Smith 3dd20022ac bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present
in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized
char **log_list.

feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2.
2006-06-05 00:31:01 +00:00
Georg Brandl 96a8c3954c Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
2006-05-29 21:04:52 +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 b2820ae355 Fix another leak in bsddb, and avoid use of uninitialized value -- funny how
gcc 4.0.x wasn't complaining about *that* one ;)
2006-03-12 00:01:38 +00:00
Thomas Wouters b3153832c2 Clean up _bsddb.c: add a couple dozen missing Py_DECREF()'s, a handful of
missing PyObject_Del()'s, simplify some code by using Py_BuildValue()
instead of creating a tuple with items manually, stop clobbering builtin
exceptions in a few places, and guard against NULL-returning functions some
more.

This fixes 117 of the 780 (!?!#%@#$!!) reference leaks in test_bsddb3. I
ain't not done yet, although this review of 5kloc was just the easy part.
2006-03-08 01:47:19 +00:00
Georg Brandl ef1701f7d3 Add additional missing checks for return vals of PyTuple_New().
Normalize coding style.
2006-03-07 14:57:48 +00:00
Thomas Wouters 89ba38152d Fix gcc 4.0.x warning about use of uninitialized value. 2006-03-07 14:14:51 +00:00
Thomas Wouters 098f6943c0 Coverity found bug: test result of PyTuple_New() against NULL before use.
Will backport.
2006-03-07 14:13:17 +00:00
Thomas Wouters 9d63ccae90 Fix DBEnv's set_tx_timestamp wrapper to be slightly more correct on
non-32bit platforms. Will still only allow 32 bits in a timestamp on Win64,
but at least it won't crash, and it'll work right on platforms where longs
are big enough to contain time_t's.

(A better-working, although conceptually less-right fix would have been to
use Py_ssize_t here, but Martin and Tim won't let me.)
2006-03-01 01:01:55 +00:00
Tim Peters 85b1052efe Another bit of unconstification. 2006-02-28 18:33:35 +00:00
Martin v. Löwis 02cbf4ae4b More unconsting. 2006-02-27 17:20:04 +00:00
Martin v. Löwis 18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Gregory P. Smith fd049a696d maintain support for older python versions in this module so that it
is ok for a standalone pybsddb source dist for use with <= 2.3.
2006-01-30 00:22:08 +00:00
Gregory P. Smith 8a47404799 Add wrapper for DBEnv.set_tx_timeout method to allow time based DB_RECOVER 2006-01-27 07:05:40 +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
Gregory P. Smith 4e414d8386 commits sourceforge patch #1407992 by neil.norwitz.
this fixes the bsddb db associate tests when compiled against
BerkeleyDB 3.3 thru 4.1.  4.2 thru 4.4 already passed and still
pass.
2006-01-24 19:55:02 +00:00
Gregory P. Smith 29602d2153 Support for BerkeleyDB 4.4 (tested against 4.4.20 as well as all the
way back thru 3.2).  This should be backported to the release24-maint
branch.
2006-01-24 09:46:48 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Neal Norwitz 40c6b47ca1 Fix errors on 64-bit platforms. Will backport 2006-01-05 05:43:35 +00:00
Jeremy Hylton af68c874a6 Add const to several API functions that take char *.
In C++, it's an error to pass a string literal to a char* function
without a const_cast().  Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.

I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc.  Predictably, there were a large set of functions that
needed to be fixed as a result of these changes.  The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].

One cast was required as a result of the changes:  A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
2005-12-10 18:50:16 +00:00
Neal Norwitz 8456235088 Get bsddb module to compile with version 3.2 of BSD DB. 2005-10-20 04:30:15 +00:00
Gregory P. Smith 8966d3de70 remove c++ style comment 2005-06-16 19:01:42 +00:00
Gregory P. Smith ac741c57d4 change set_bt_compare() callback comparison function to only take two
arguments (left, right) like any sane comparison function.  no need to
pass in the db object as an argument.
2005-06-06 17:31:32 +00:00
Gregory P. Smith 91116b629e additional sanity check. secondaryDB cannot be closed. 2005-06-06 10:28:06 +00:00
Gregory P. Smith 692ca9a0cb fixes pybsddb SF bug id 1215432. DB.associate() would crash when a
DBError was supposed to be raised.

needs backport to 2.4.x and possibly 2.3.x.
2005-06-06 09:55:06 +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
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
Gregory P. Smith 8a6a59c58b fixed compilation against BerkeleyDB 3.2.9 (sf bug # 1077040) 2004-12-16 09:47:28 +00:00
Gregory P. Smith 8b7e917ab2 * Adds support for building against BerkeleyDB 4.3.21
* bumped the module version number up to 4.3.0
2004-12-13 09:51:23 +00:00
Gregory P. Smith 442c9fc376 SF bug 1017405: the keys() values() and items() DB methods were
ignoring their transaction (txn) argument.
2004-09-04 01:36:59 +00:00
Neal Norwitz 37b0c1dbf4 Fix memory leak and bump the version per Greg 2004-07-09 23:33:06 +00:00
Neal Norwitz b4a55813fe Cleanup support for older pythons (perhaps it should be removed?) 2004-07-09 23:30:57 +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 31c50659ea Add weakref support to all bsddb.db objects.
Make DBTxn objects automatically call abort() in their destructor if
not yet finalized and raise a RuntimeWarning to that effect.
2004-06-28 01:20:40 +00:00