swig/swig-3.0.5_fix-python-modern-buildin.patch

24 lines
960 B
Diff

From e06906bda0ea06f6b5fc15dfa8f55a2251a1bbef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <bjoern.esser@gmail.com>
Date: Fri, 3 Apr 2015 18:48:08 +0200
Subject: [PATCH] Python: fix using `-builtin -modern -modernargs` results in
segfaulting code (#256)
---
Source/Modules/python.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index 0e4a402..b2c429d 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -2718,7 +2718,7 @@ class PYTHON:public Language {
Printf(parse_args, "if (!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,0)) SWIG_fail;\n", iname, num_fixed_arguments, tuple_arguments);
}
}
- } else {
+ } else if (tuple_arguments > 0) {
Printf(parse_args, "if(!PyArg_UnpackTuple(args,(char *)\"%s\",%d,%d", iname, num_fixed_arguments, tuple_arguments);
Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
}