Fix Python typedef bool default arguments that are not booleans.

Includes code optimisation in PYTHON::convertValue().

Closes #327
This commit is contained in:
William S Fulton 2015-05-27 20:51:20 +01:00
commit 986a13f1a0
4 changed files with 29 additions and 19 deletions

View file

@ -8,6 +8,10 @@ struct Display {
float draw2(float *v = 0) { return v ? *v : 0; }
bool bool0(bool x = 0) { return x; }
bool bool1(bool x = 1) { return x; }
typedef bool mybool;
bool mybool0(mybool x = 0) { return x; }
bool mybool1(mybool x = 1) { return x; }
};
float* createPtr(float v) { static float val; val = v; return &val; }
%}
@ -18,5 +22,9 @@ struct Display {
float draw2(float *v = NULL) { return v ? *v : 0; }
bool bool0(bool x = 0) { return x; }
bool bool1(bool x = 1) { return x; }
typedef bool mybool;
bool mybool0(mybool x = 0) { return x; }
bool mybool1(mybool x = 1) { return x; }
};
float* createPtr(float v) { static float val; val = v; return &val; }

View file

@ -20,3 +20,9 @@ if d.bool0() != False or type(d.bool0()) != type(False):
if d.bool1() != True or type(d.bool1()) != type(True):
raise RuntimeError
if d.mybool0() != False or type(d.mybool0()) != type(False):
raise RuntimeError
if d.mybool1() != True or type(d.mybool1()) != type(True):
raise RuntimeError