summaryrefslogtreecommitdiffstats
path: root/Modules/_bsddb.c
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-03-01 01:01:55 (GMT)
committerThomas Wouters <thomas@python.org>2006-03-01 01:01:55 (GMT)
commit9d63ccae909122dc5a6e4dc793ad3c3885cc5bdc (patch)
tree34f5100518509ebae75edd8d4f98b75331853bd4 /Modules/_bsddb.c
parentca82a8b7604ba0ace261a75eb204d9fab765cdbf (diff)
downloadcpython-9d63ccae909122dc5a6e4dc793ad3c3885cc5bdc.zip
cpython-9d63ccae909122dc5a6e4dc793ad3c3885cc5bdc.tar.gz
cpython-9d63ccae909122dc5a6e4dc793ad3c3885cc5bdc.tar.bz2
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.)
Diffstat (limited to 'Modules/_bsddb.c')
-rw-r--r--Modules/_bsddb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index c769a11..8f8eab2 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -4190,13 +4190,14 @@ static PyObject*
DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args)
{
int err;
- time_t stamp;
+ long stamp;
+ time_t timestamp;
- if (!PyArg_ParseTuple(args, "i:set_tx_timestamp", &stamp))
+ if (!PyArg_ParseTuple(args, "l:set_tx_timestamp", &stamp))
return NULL;
CHECK_ENV_NOT_CLOSED(self);
-
- err = self->db_env->set_tx_timestamp(self->db_env, &stamp);
+ timestamp = (time_t)stamp;
+ err = self->db_env->set_tx_timestamp(self->db_env, &timestamp);
RETURN_IF_ERR();
RETURN_NONE();
}