From 90d08988b26017608959fcb8d65fdca57db4d6e8 Mon Sep 17 00:00:00 2001 From: Etienne Wodey Date: Fri, 3 Apr 2020 18:19:46 +0200 Subject: [PATCH] language/environment: BooleanValue: fix type detection Signed-off-by: Etienne Wodey --- artiq/language/environment.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/artiq/language/environment.py b/artiq/language/environment.py index eff9fc3f1..fddae667f 100644 --- a/artiq/language/environment.py +++ b/artiq/language/environment.py @@ -54,7 +54,6 @@ class PYONValue(_SimpleArgProcessor): def __init__(self, default=NoDefault): # Override the _SimpleArgProcessor init, as list defaults are valid # PYON values - # default stays decoded if default is not NoDefault: self.default_value = default @@ -71,12 +70,9 @@ class PYONValue(_SimpleArgProcessor): class BooleanValue(_SimpleArgProcessor): """A boolean argument.""" def process(self, x): - if x is True: - return True - elif x is False: - return False - else: + if type(x) != bool: raise ValueError("Invalid BooleanValue value") + return x class EnumerationValue(_SimpleArgProcessor):