From 7b3cbe023e45573f9852fd1a774a0fc9d4d51b5d Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 4 Mar 2013 11:54:06 +0100 Subject: [PATCH] Fix convert-constants handling of booleans MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It turns out that, in Python, booleans are also integers. So they fall under the βisinstance(value, int)β case, resulting in all enable* constants being integers in Haskell, which is not nice, even though we're not using them directly today. Patch simply adds a special casing for booleans, before integers. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- autotools/convert-constants | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autotools/convert-constants b/autotools/convert-constants index c9695f4fd..e5296ea78 100755 --- a/autotools/convert-constants +++ b/autotools/convert-constants @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2011, 2012 Google Inc. +# Copyright (C) 2011, 2012, 2013 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -87,6 +87,8 @@ def HaskellTypeVal(value): """ if isinstance(value, basestring): return ("String", "\"%s\"" % StringValueRules(value)) + elif isinstance(value, bool): + return ("Bool", "%s" % value) elif isinstance(value, int): return ("Int", "%d" % value) elif isinstance(value, long): -- GitLab