diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index b53c4aace..6d3e25d04 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -128,7 +128,7 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { /* Unpack the argument tuple */ SWIGINTERN int -SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs) +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { @@ -143,7 +143,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyOb PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { - register int l = PyTuple_GET_SIZE(args); + register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), min, l); diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index e61755fc7..0e5fbc04b 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1475,7 +1475,7 @@ public: if (!fastunpack) { Wrapper_add_local(f, "ii", "int ii"); Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n"); - Append(f->code, "argc = PyObject_Length(args);\n"); + Append(f->code, "argc = (int)PyObject_Length(args);\n"); Printf(f->code, "for (ii = 0; (ii < argc) && (ii < %d); ii++) {\n", maxargs); Append(f->code, "argv[ii] = PyTuple_GET_ITEM(args,ii);\n"); Append(f->code, "}\n");