Fix Python negative unsigned default values

Closes #993
This commit is contained in:
William S Fulton 2017-05-20 23:57:15 +01:00
commit 81ba06e59e
4 changed files with 11 additions and 0 deletions

View file

@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.0.0 (in progress)
===========================
2017-05-21: wsfulton
[Python] #993 Fix handling of default -ve unsigned values, such as:
void f(unsigned = -1U);
2017-05-20: jschueller
[Python] #991 Fix E731 PEP8 warning: do not assign a lambda expression

View file

@ -156,6 +156,9 @@
int double_if_handle_is_null(int n, MyHandle h = 0) { return h ? n : 2*n; }
int double_if_dbl_ptr_is_null(int n, double* null_by_default)
{ return null_by_default ? n : 2*n; }
void defaulted1(unsigned offset = -1U) {} // minus unsigned!
void defaulted2(int offset = -1U) {} // minus unsigned!
};
int Foo::bar = 1;
int Foo::spam = 2;

View file

@ -32,6 +32,8 @@ def run(module_name):
f.newname()
f.newname(1)
f.defaulted1()
f.defaulted2()
if f.double_if_void_ptr_is_null(2, None) != 4:
raise RuntimeError

View file

@ -2115,6 +2115,8 @@ public:
case 'u':
case 'U':
if (value < 0)
fail = true;
break;
default: