From c29e95e5ce621c552cd22aacd437a22fda0f8fe2 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Mon, 30 Dec 2019 16:54:23 +0100 Subject: [PATCH] bind: use python case for booleans Fixes #207. --- bind/gen_varconst.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bind/gen_varconst.go b/bind/gen_varconst.go index 6b098b2..981c369 100644 --- a/bind/gen_varconst.go +++ b/bind/gen_varconst.go @@ -110,5 +110,12 @@ func (g *pyGen) genVarSetter(v *Var) { func (g *pyGen) genConstValue(c *Const) { // constants go directly into wrapper as-is - g.pywrap.Printf("%s = %s\n", c.GoName(), c.obj.Val().ExactString()) + val := c.obj.Val().ExactString() + switch val { + case "true": + val = "True" + case "false": + val = "False" + } + g.pywrap.Printf("%s = %s\n", c.GoName(), val) }