Skip to content

Commit

Permalink
Use Py_ssize_t for length arguments of PyObject_CallFunction
Browse files Browse the repository at this point in the history
This API was introduced in Python 2.5 and the old one (using ints) has
been deprecated since Python 3.8.

See #108.
  • Loading branch information
mgedmin committed Mar 26, 2019
1 parent 0d12ebe commit 5b24c6f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions persistent/cPersistence.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ static char cPersistence_doc_string[] =
"\n"
"$Id$\n";

#define PY_SSIZE_T_CLEAN
#include "cPersistence.h"
#include "structmember.h"

Expand Down Expand Up @@ -1268,9 +1269,9 @@ Per_get_mtime(cPersistentObject *self)
}

#ifdef PY3K
t = PyObject_CallFunction(TimeStamp, "y#", self->serial, 8);
t = PyObject_CallFunction(TimeStamp, "y#", self->serial, (Py_ssize_t)8);
#else
t = PyObject_CallFunction(TimeStamp, "s#", self->serial, 8);
t = PyObject_CallFunction(TimeStamp, "s#", self->serial, (Py_ssize_t)8);
#endif
if (!t)
{
Expand Down

0 comments on commit 5b24c6f

Please sign in to comment.