From 7504cb205b4851c262cafdcb7be1ebfddb9a1d1f Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Fri, 9 Jan 2015 08:24:24 +0000 Subject: [PATCH] modpython: Enable default arguments feature of SWIG 3.0.4 Some corner cases are disabled for now, until SWIG fixes them. See #809 for details. --- modules/modpython/modpython.i | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/modpython/modpython.i b/modules/modpython/modpython.i index d1fc0948..ed578cd0 100644 --- a/modules/modpython/modpython.i +++ b/modules/modpython/modpython.i @@ -14,7 +14,9 @@ * limitations under the License. */ -%module znc_core %{ +%module znc_core + +%{ #include #include "../include/znc/Utils.h" #include "../include/znc/Threads.h" @@ -51,6 +53,14 @@ using std::allocator; %apply long { uint32_t }; %apply long { uint64_t }; +// Just makes generated python code slightly more beautiful. +%feature("python:defaultargs"); +// Probably can be removed when swig is fixed to not produce bad code for some cases +%feature("python:defaultargs", "0") CDir::MakeDir; // 0700 doesn't work in python3 +%feature("python:defaultargs", "0") CUtils::GetNumInput; // SyntaxError: non-default argument follows default argument +%feature("python:defaultargs", "0") CModules::GetAvailableMods; // NameError: name 'UserModule' is not defined +%feature("python:defaultargs", "0") CModules::GetDefaultMods; // NameError: name 'UserModule' is not defined + %begin %{ #include "znc/zncconfig.h" %}