Fix Python typedef bool default arguments that are not booleans.
Includes code optimisation in PYTHON::convertValue(). Closes #327
This commit is contained in:
parent
0a70498591
commit
986a13f1a0
4 changed files with 29 additions and 19 deletions
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue