mirror of https://github.com/python/cpython.git
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.
This commit is contained in:
parent
1985ff76ca
commit
3dd20022ac
|
@ -665,6 +665,9 @@ def test06_Transactions(self):
|
||||||
for log in logs:
|
for log in logs:
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'log file: ' + log
|
print 'log file: ' + log
|
||||||
|
if db.version >= (4,2):
|
||||||
|
logs = self.env.log_archive(db.DB_ARCH_REMOVE)
|
||||||
|
assert not logs
|
||||||
|
|
||||||
self.txn = self.env.txn_begin()
|
self.txn = self.env.txn_begin()
|
||||||
|
|
||||||
|
|
|
@ -4371,13 +4371,17 @@ DBEnv_log_archive(DBEnvObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
int flags=0;
|
int flags=0;
|
||||||
int err;
|
int err;
|
||||||
char **log_list_start, **log_list;
|
char **log_list = NULL;
|
||||||
PyObject* list;
|
PyObject* list;
|
||||||
PyObject* item = NULL;
|
PyObject* item = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|i:log_archive", &flags))
|
if (!PyArg_ParseTuple(args, "|i:log_archive", &flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
list = PyList_New(0);
|
||||||
|
if (list == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
CHECK_ENV_NOT_CLOSED(self);
|
CHECK_ENV_NOT_CLOSED(self);
|
||||||
MYDB_BEGIN_ALLOW_THREADS;
|
MYDB_BEGIN_ALLOW_THREADS;
|
||||||
#if (DBVER >= 40)
|
#if (DBVER >= 40)
|
||||||
|
@ -4390,11 +4394,8 @@ DBEnv_log_archive(DBEnvObject* self, PyObject* args)
|
||||||
MYDB_END_ALLOW_THREADS;
|
MYDB_END_ALLOW_THREADS;
|
||||||
RETURN_IF_ERR();
|
RETURN_IF_ERR();
|
||||||
|
|
||||||
list = PyList_New(0);
|
|
||||||
if (list == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (log_list) {
|
if (log_list) {
|
||||||
|
char **log_list_start;
|
||||||
for (log_list_start = log_list; *log_list != NULL; ++log_list) {
|
for (log_list_start = log_list; *log_list != NULL; ++log_list) {
|
||||||
item = PyString_FromString (*log_list);
|
item = PyString_FromString (*log_list);
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
|
@ -5247,6 +5248,9 @@ DL_EXPORT(void) init_bsddb(void)
|
||||||
ADD_INT(d, DB_ARCH_ABS);
|
ADD_INT(d, DB_ARCH_ABS);
|
||||||
ADD_INT(d, DB_ARCH_DATA);
|
ADD_INT(d, DB_ARCH_DATA);
|
||||||
ADD_INT(d, DB_ARCH_LOG);
|
ADD_INT(d, DB_ARCH_LOG);
|
||||||
|
#if (DBVER >= 42)
|
||||||
|
ADD_INT(d, DB_ARCH_REMOVE);
|
||||||
|
#endif
|
||||||
|
|
||||||
ADD_INT(d, DB_BTREE);
|
ADD_INT(d, DB_BTREE);
|
||||||
ADD_INT(d, DB_HASH);
|
ADD_INT(d, DB_HASH);
|
||||||
|
|
Loading…
Reference in New Issue