Fix platorm inconsistency in Python default argument handling.

32 bit and 64 bit compiled versions of SWIG generated different Python files
when default arguments were outside the range of 32 bit signed integers.
The default arguments specified in Python are now only those that are in the
range of a 32 bit signed integer, otherwise the default is obtained from C/C++ code.

Closes #1108
This commit is contained in:
William S Fulton 2017-10-06 21:57:04 +01:00
commit 4a7976a5d8
4 changed files with 48 additions and 0 deletions

View file

@ -28,6 +28,14 @@
int value_perm(int first, int mode = 0640 | 0004) { return mode; }
int value_m01(int first, int val = -01) { return val; }
bool booltest2(bool x = 0 | 1) { return x; }
int max_32bit_int1(int a = 0x7FFFFFFF) { return a; }
int max_32bit_int2(int a = 2147483647) { return a; }
int min_32bit_int1(int a = -0x80000000) { return a; }
int min_32bit_int2(int a = -2147483648) { return a; }
long long too_big_32bit_int1(long long a = 0x80000000) { return a; }
long long too_big_32bit_int2(long long a = 2147483648LL) { return a; }
long long too_small_32bit_int1(long long a = -0x80000001) { return a; }
long long too_small_32bit_int2(long long a = -2147483649LL) { return a; }
};
void doublevalue1(int first, double num = 0.0e-1) {}