Add new feature "python:cdefaultargs"

Controls default argument code generation to obtain the default
arguments from the C++ layer instead of the Python layer.
This commit is contained in:
William S Fulton 2015-05-28 20:11:57 +01:00
commit b8e1a66a38
5 changed files with 153 additions and 3 deletions

View file

@ -2082,9 +2082,10 @@ public:
1. The function is overloaded as Python doesn't support this.
2. We were explicitly asked to use the "compact" arguments form.
3. One of the default argument values can't be represented in Python.
3. We were explicitly asked to use default args from C via the "python:cdefaultargs" feature.
4. One of the default argument values can't be represented in Python.
*/
if (is_real_overloaded(n) || GetFlag(n, "feature:compactdefaultargs") || !is_representable_as_pyargs(n)) {
if (is_real_overloaded(n) || GetFlag(n, "feature:compactdefaultargs") || GetFlag(n, "feature:python:cdefaultargs") || !is_representable_as_pyargs(n)) {
String *parms = NewString("");
if (in_class)
Printf(parms, "self, ");