Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d63cca

Browse files
committed
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.)
1 parent ca82a8b commit 9d63cca

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Modules/_bsddb.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4190,13 +4190,14 @@ static PyObject*
41904190
DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args)
41914191
{
41924192
int err;
4193-
time_t stamp;
4193+
long stamp;
4194+
time_t timestamp;
41944195

4195-
if (!PyArg_ParseTuple(args, "i:set_tx_timestamp", &stamp))
4196+
if (!PyArg_ParseTuple(args, "l:set_tx_timestamp", &stamp))
41964197
return NULL;
41974198
CHECK_ENV_NOT_CLOSED(self);
4198-
4199-
err = self->db_env->set_tx_timestamp(self->db_env, &stamp);
4199+
timestamp = (time_t)stamp;
4200+
err = self->db_env->set_tx_timestamp(self->db_env, &timestamp);
42004201
RETURN_IF_ERR();
42014202
RETURN_NONE();
42024203
}

0 commit comments

Comments
 (0)