Skip to content

Instantly share code, notes, and snippets.

@srepmub
Created February 13, 2017 09:50
Show Gist options
  • Save srepmub/003ad31170991ff69be0cc5a3bd51ab5 to your computer and use it in GitHub Desktop.
Save srepmub/003ad31170991ff69be0cc5a3bd51ab5 to your computer and use it in GitHub Desktop.
swig_coverity_pytuple_check.patch
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index a6801fc4e..ae87c606e 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -2542,7 +2542,7 @@ 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, "if (args && !PyTuple_Check(args)) SWIG_fail;\n");
Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n");
if (add_self)
Append(f->code, "argv[0] = self;\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment