[pypy-commit] cffi default: Parse the imposed field offsets as Py_ssize_t, in case they don't fit

arigo noreply at buildbot.pypy.org
Thu Apr 16 17:20:10 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1735:9caeb942edf5
Date: 2015-04-16 16:40 +0200
http://bitbucket.org/cffi/cffi/changeset/9caeb942edf5/

Log:	Parse the imposed field offsets as Py_ssize_t, in case they don't
	fit into an "int".

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -3761,9 +3761,10 @@
     for (i=0; i<nb_fields; i++) {
         PyObject *fname;
         CTypeDescrObject *ftype;
-        int fbitsize = -1, falign, do_align, foffset = -1;
-
-        if (!PyArg_ParseTuple(PyList_GET_ITEM(fields, i), "O!O!|ii:list item",
+        int fbitsize = -1, falign, do_align;
+        Py_ssize_t foffset = -1;
+
+        if (!PyArg_ParseTuple(PyList_GET_ITEM(fields, i), "O!O!|in:list item",
                               &PyText_Type, &fname,
                               &CTypeDescr_Type, &ftype,
                               &fbitsize, &foffset))


More information about the pypy-commit mailing list