Merge branch 'srepmub-coverity_args_check'

* srepmub-coverity_args_check:
  [Coverity] fix issue reported for wrapper argument checking
This commit is contained in:
William S Fulton 2017-03-24 07:26:54 +00:00
commit 29af5c7aec

View file

@ -2541,9 +2541,14 @@ public:
if (!fastunpack) {
Wrapper_add_local(f, "ii", "Py_ssize_t ii");
if (maxargs - (add_self ? 1 : 0) > 0)
Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n");
Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n");
if (maxargs - (add_self ? 1 : 0) > 0) {
Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n");
Append(f->code, "argc = PyObject_Length(args);\n");
} else {
Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n");
}
if (add_self)
Append(f->code, "argv[0] = self;\n");
Printf(f->code, "for (ii = 0; (ii < %d) && (ii < argc); ii++) {\n", add_self ? maxargs - 1 : maxargs);