Revert introduction of python:defaultargs feature

See issue #294
This commit is contained in:
William S Fulton 2015-01-12 21:35:47 +00:00
commit 9d87b9f099
7 changed files with 29 additions and 55 deletions

View file

@ -9,15 +9,10 @@ Version 3.0.4 (in progress)
[PHP] Fix segfault in director upcall check when using PHP built with [PHP] Fix segfault in director upcall check when using PHP built with
ZTS enabled. Fixes #155, reported by Pierre Labastie. ZTS enabled. Fixes #155, reported by Pierre Labastie.
2015-01-08: wsfulton 2015-01-12: vadz
[Python] Fix #294 #296 - Regression introduced in SWIG-3.0.3 when [Python] Fix #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments. Now any method with default wrapping functions with default arguments. Invalid or missing default
arguments obtains the default arguments from C++ instead of generating arguments were sometimes being generated into the python layer.
Python code with the default arguments.
The "python:defaultargs" feature has been introduced for users to
optionally generate Python methods with the default arguments instead
the default *args.
2015-01-08: olly 2015-01-08: olly
Allow C++11 "explicit constexpr". Fixes github issue #284 reported Allow C++11 "explicit constexpr". Fixes github issue #284 reported

View file

@ -13,7 +13,7 @@
%inline %{ %inline %{
#include <string> #include <string>
// All kinds of numbers: hex, octal (which pose special problems to Python (using %pythondefaultargs), negative... // All kinds of numbers: hex, octal (which pose special problems to Python), negative...
void trickyvalue1(int first, int pos = -1) {} void trickyvalue1(int first, int pos = -1) {}
void trickyvalue2(int first, unsigned rgb = 0xabcdef) {} void trickyvalue2(int first, unsigned rgb = 0xabcdef) {}
void trickyvalue3(int first, int mode = 0644) {} void trickyvalue3(int first, int mode = 0644) {}
@ -23,6 +23,10 @@
// Long long arguments are not handled at Python level currently but still work. // Long long arguments are not handled at Python level currently but still work.
void seek(long long offset = 0LL) {} void seek(long long offset = 0LL) {}
void seek2(unsigned long long offset = 0ULL) {}
void seek3(long offset = 0L) {}
void seek4(unsigned long offset = 0UL) {}
void seek5(unsigned long offset = 0U) {}
// Anonymous arguments // Anonymous arguments
int anonymous(int = 7771); int anonymous(int = 7771);

View file

@ -58,7 +58,6 @@ CPP_TEST_CASES += \
primitive_types \ primitive_types \
python_abstractbase \ python_abstractbase \
python_append \ python_append \
python_default_args \
python_director \ python_director \
python_nondynamic \ python_nondynamic \
python_overload_simple_cast \ python_overload_simple_cast \

View file

@ -1,3 +0,0 @@
# Test %feature("python:defaultargs") using the test code in default_args_runme.py (which does not use the feature)
import default_args_runme
default_args_runme.run('python_default_args')

View file

@ -1,6 +0,0 @@
%module python_default_args
// Testing use of %pythondefaultargs
%pythondefaultargs;
%include "default_args.i"

View file

@ -185,17 +185,6 @@ These methods "may be called" if needed.
#define %clearpythonappend %feature("pythonappend","") #define %clearpythonappend %feature("pythonappend","")
/* ------------------------------------------------------------------------- */
/*
Python default argument handling (for non-builtin)
*/
#define %pythondefaultargs %feature("python:defaultargs")
#define %nopythondefaultargs %feature("python:defaultargs", "0")
#define %clearpythondefaultargs %feature("python:defaultargs", "")
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* /*
%extend_smart_pointer extend the smart pointer support. %extend_smart_pointer extend the smart pointer support.

View file

@ -1975,7 +1975,6 @@ public:
bool is_representable = true; bool is_representable = true;
if (Getattr(n, "sym:overloaded")) { if (Getattr(n, "sym:overloaded")) {
if (GetFlag(n, "feature:python:defaultargs")) {
ParmList *plist = CopyParmList(Getattr(n, "parms")); ParmList *plist = CopyParmList(Getattr(n, "parms"));
Parm *p; Parm *p;
Parm *pnext; Parm *pnext;
@ -2000,9 +1999,6 @@ public:
} }
} }
} }
} else {
is_representable = false;
}
} }
return is_representable; return is_representable;
} }