From 49a0706c0fe56e4b0fafb813f6fdd59bd0dd067a Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Mon, 3 Jun 2019 10:00:06 -0700 Subject: [PATCH] Allow boolean as default parameter cf. https://bugs.python.org/issue26146 --- vyper/signatures/function_signature.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vyper/signatures/function_signature.py b/vyper/signatures/function_signature.py index 8462aa75f8..47a35af722 100644 --- a/vyper/signatures/function_signature.py +++ b/vyper/signatures/function_signature.py @@ -168,7 +168,8 @@ def from_definition(cls, # Validate default values. for default_value in getattr(code.args, 'defaults', []): - if not isinstance(default_value, (ast.Num, ast.Str, ast.Bytes, ast.List)): + allowed_types = (ast.Num, ast.Str, ast.Bytes, ast.List, ast.NameConstant) + if not isinstance(default_value, allowed_types): raise FunctionDeclarationException("Default parameter values have to be literals.") # Determine the arguments, expects something of the form def foo(arg1: