Merge 58343: attempt to fix DBSequence.get_key() to not fail or crash.

This commit is contained in:
Gregory P. Smith 2007-10-06 08:22:26 +00:00
parent 1d2aef5ccf
commit 9e780cc4e7
1 changed files with 7 additions and 1 deletions

View File

@ -5024,14 +5024,20 @@ DBSequence_get_key(DBSequenceObject* self, PyObject* args)
{
int err;
DBT key;
PyObject *retval;
key.flags = DB_DBT_MALLOC;
CHECK_SEQUENCE_NOT_CLOSED(self)
MYDB_BEGIN_ALLOW_THREADS
err = self->sequence->get_key(self->sequence, &key);
MYDB_END_ALLOW_THREADS
if (!err)
retval = PyBytes_FromStringAndSize(key.data, key.size);
free_dbt(&key);
RETURN_IF_ERR();
return PyBytes_FromStringAndSize(key.data, key.size);
return retval;
}
static PyObject*