Fix types when calling PyTuple_New

Replace int with Py_ssize_t to fix warnings on Windows when using -O
and/or -builtin.
This commit is contained in:
William S Fulton 2017-08-27 11:11:32 +01:00
commit fbada9959c
2 changed files with 6 additions and 5 deletions

View file

@ -393,10 +393,10 @@ SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {
SWIGINTERN void SWIGINTERN void
SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) { SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) {
int base_count = 0; Py_ssize_t base_count = 0;
PyTypeObject **b; PyTypeObject **b;
PyObject *tuple; PyObject *tuple;
int i; Py_ssize_t i;
if (!bases[0]) { if (!bases[0]) {
bases[0] = SwigPyObject_type(); bases[0] = SwigPyObject_type();

View file

@ -2927,9 +2927,9 @@ public:
Clear(f->def); Clear(f->def);
if (overname) { if (overname) {
if (noargs) { if (noargs) {
Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {", NIL); Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {", NIL);
} else { } else {
Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", int nobjs, PyObject **swig_obj) {", NIL); Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", Py_ssize_t nobjs, PyObject **swig_obj) {", NIL);
} }
Printf(parse_args, "if ((nobjs < %d) || (nobjs > %d)) SWIG_fail;\n", num_required, num_arguments); Printf(parse_args, "if ((nobjs < %d) || (nobjs > %d)) SWIG_fail;\n", num_required, num_arguments);
} else { } else {
@ -3238,7 +3238,8 @@ public:
DelWrapper(f); DelWrapper(f);
f = NewWrapper(); f = NewWrapper();
if (funpack) { if (funpack) {
Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", int nobjs, PyObject **swig_obj) {", NIL); // Note: funpack is currently always false for varargs
Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", Py_ssize_t nobjs, PyObject **swig_obj) {", NIL);
} else { } else {
Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args) {", NIL); Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args) {", NIL);
} }