From 214dfb6b8e0d986aa0fed467f64e2fcdcb2e3687 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Fri, 3 Feb 2006 09:08:27 +0000 Subject: [PATCH] add missing check for noargs git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8690 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/test-suite/global_ns_arg.i | 4 ++++ SWIG/Examples/test-suite/python/global_ns_arg_runme.py | 5 +++++ SWIG/Source/Modules/python.cxx | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 SWIG/Examples/test-suite/python/global_ns_arg_runme.py diff --git a/SWIG/Examples/test-suite/global_ns_arg.i b/SWIG/Examples/test-suite/global_ns_arg.i index 5b7b8bb12..3554fd814 100644 --- a/SWIG/Examples/test-suite/global_ns_arg.i +++ b/SWIG/Examples/test-suite/global_ns_arg.i @@ -8,4 +8,8 @@ typedef int Integer; return x; } +::Integer bar() { + return 1; +} + %} diff --git a/SWIG/Examples/test-suite/python/global_ns_arg_runme.py b/SWIG/Examples/test-suite/python/global_ns_arg_runme.py new file mode 100644 index 000000000..e597db5f8 --- /dev/null +++ b/SWIG/Examples/test-suite/python/global_ns_arg_runme.py @@ -0,0 +1,5 @@ +from global_ns_arg import * + +a = foo(1) +b = bar() + diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index 080ecf791..9f586401f 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -1745,7 +1745,7 @@ public: } else { if (noargs) { Printv(f->def, "SWIGINTERN PyObject *", wname, - "(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(args)) {", NIL); + "(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {", NIL); } else { Printv(f->def, "SWIGINTERN PyObject *", wname, "(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {", NIL); @@ -1755,6 +1755,9 @@ public: } else if (!noargs) { Printf(parse_args,"if(!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,swig_obj)) SWIG_fail;\n", iname, num_required, num_arguments); + } else if (noargs) { + Printf(parse_args,"if(!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,0)) SWIG_fail;\n", + iname, num_required, num_arguments); } } } else {