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:
Gergely Nagy 2015-08-11 10:43:00 +02:00
parent e407b0a605
commit b362943365
2 changed files with 2 additions and 2 deletions

View File

@ -461,7 +461,7 @@ class HyASTCompiler(object):
except StopIteration: except StopIteration:
raise HyTypeError(expr, raise HyTypeError(expr,
"Keyword argument {kw} needs " "Keyword argument {kw} needs "
"a value.".format(kw=str(expr))) "a value.".format(kw=str(expr[1:])))
compiled_value = self.compile(value) compiled_value = self.compile(value)
ret += compiled_value ret += compiled_value

View File

@ -444,7 +444,7 @@ def test_missing_keyword_argument_value():
try: try:
can_compile("((fn [x] x) :x)") can_compile("((fn [x] x) :x)")
except HyTypeError as e: except HyTypeError as e:
assert(e.message == "Keyword argument \ufdd0:x needs a value.") assert(e.message == "Keyword argument :x needs a value.")
else: else:
assert(False) assert(False)