mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-23 09:23:43 +03:00
Fixed argument parsing in lobject.read
Using an int instead of a Py_ssize_t randomly crashed Python 3.1 64 bit.
This commit is contained in:
parent
80bd6e2794
commit
b8c8cddc2d
|
@ -71,7 +71,8 @@ psyco_lobj_close(lobjectObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
psyco_lobj_write(lobjectObject *self, PyObject *args)
|
||||
{
|
||||
int len, res=0;
|
||||
int res = 0;
|
||||
Py_ssize_t len;
|
||||
const char *buffer;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s#", &buffer, &len)) return NULL;
|
||||
|
@ -80,7 +81,7 @@ psyco_lobj_write(lobjectObject *self, PyObject *args)
|
|||
EXC_IF_LOBJ_LEVEL0(self);
|
||||
EXC_IF_LOBJ_UNMARKED(self);
|
||||
|
||||
if ((res = lobject_write(self, buffer, len)) < 0) return NULL;
|
||||
if ((res = lobject_write(self, buffer, (size_t)len)) < 0) return NULL;
|
||||
|
||||
return PyInt_FromLong((long)res);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user