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 {