From 48d481b5d374f40fcc99afe36763c9568a19c688 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Fri, 20 Mar 2020 12:56:49 -0400 Subject: [PATCH] Fix a check for empty input in `macroexpand` The equality check hasn't done the right thing since HyExpression became tuple-backed (#1804). --- NEWS.rst | 2 ++ hy/macros.py | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 7a523da..61d7dfc 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -13,6 +13,8 @@ Bug Fixes * Improved support for nesting anaphoric macros by only applying symbol replacement where absolutely necessary. * Quoted f-strings are no longer evaluated prematurely. +* Fixed a regression in the production of error messages for empty + expressions. 0.18.0 ============================== diff --git a/hy/macros.py b/hy/macros.py index 27a669c..cb8178e 100644 --- a/hy/macros.py +++ b/hy/macros.py @@ -308,10 +308,7 @@ def macroexpand(tree, module, compiler=None, once=False): assert not compiler or compiler.module == module - while True: - - if not isinstance(tree, HyExpression) or tree == []: - break + while isinstance(tree, HyExpression) and tree: fn = tree[0] if fn in ("quote", "quasiquote") or not isinstance(fn, HySymbol):