compiler: Fix the kw argument needs value exception
Strip the \ufdd0 prefix from the keyword argument before turning it into a string: the same representation the user entered looks better, and is printable too, thus Python2 doesn't choke on it. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
parent
e407b0a605
commit
b362943365
@ -461,7 +461,7 @@ class HyASTCompiler(object):
|
||||
except StopIteration:
|
||||
raise HyTypeError(expr,
|
||||
"Keyword argument {kw} needs "
|
||||
"a value.".format(kw=str(expr)))
|
||||
"a value.".format(kw=str(expr[1:])))
|
||||
|
||||
compiled_value = self.compile(value)
|
||||
ret += compiled_value
|
||||
|
@ -444,7 +444,7 @@ def test_missing_keyword_argument_value():
|
||||
try:
|
||||
can_compile("((fn [x] x) :x)")
|
||||
except HyTypeError as e:
|
||||
assert(e.message == "Keyword argument \ufdd0:x needs a value.")
|
||||
assert(e.message == "Keyword argument :x needs a value.")
|
||||
else:
|
||||
assert(False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user