From a7e1bf6c9f2a77fd47f63382a9d8372bc1a15e34 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sun, 7 Mar 2021 19:21:35 +0100 Subject: [PATCH] cl_parse_key: correctly handle literal allow-other-keys keyword arguments When parsing keyword arguments of functions like (defun f (&key allow-other-keys) allow-other-keys) (note that `&key allow-other-keys` is not `&allow-other-keys`!), we were incorrectly handling the case in which this function was called like (f :some-unknown-keyword x :allow-other-keys non-nil-value) In this case, the spec (CLHS 3.4.1.4) says that the function has to ignore the unknown keyword and return the non-nil-value, while we were signaling an "unknown keyword" error. --- src/c/cmpaux.d | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/c/cmpaux.d b/src/c/cmpaux.d index 682f6b352..3e4664da0 100644 --- a/src/c/cmpaux.d +++ b/src/c/cmpaux.d @@ -216,6 +216,12 @@ cl_parse_key( FEprogram_error("Odd number of keys", 0); if (ecl_unlikely(unknown_keyword != OBJNULL && !allow_other_keys && (supplied_allow_other_keys == ECL_NIL || - supplied_allow_other_keys == OBJNULL))) + supplied_allow_other_keys == OBJNULL))) { + for (i = 0; i < nkey; i++) { + if (keys[i] == @':allow-other-keys' && vars[nkey+i] == ECL_T && !Null(vars[i])) { + return; + } + } FEprogram_error("Unknown keyword ~S", 1, unknown_keyword); + } }