changeset: 5355:28651c24b3f8
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat Nov 06 14:51:13 2010 +0000
files: src/ChangeLog src/fns.c tests/ChangeLog tests/automated/lisp-tests.el
description:
Error in #'list-length if LIST is dotted; check for this error with #'mapcar
src/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (Flist_length): Error if LIST is dotted in this function;
document this behaviour.
tests/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el (malformed-list): Check that #'mapcar,
#'map and #'list-length throw this error when appropriate.
diff -r 99006e0b3a84 -r 28651c24b3f8 src/ChangeLog
--- a/src/ChangeLog Tue Nov 02 20:19:39 2010 +0100
+++ b/src/ChangeLog Sat Nov 06 14:51:13 2010 +0000
@@ -1,3 +1,8 @@
+2010-11-06 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * fns.c (Flist_length): Error if LIST is dotted in this function;
+ document this behaviour.
+
2010-10-25 Aidan Kehoe <kehoea(a)parhasard.net>
* specifier.c (specifier_instance_from_inst_list):
diff -r 99006e0b3a84 -r 28651c24b3f8 src/fns.c
--- a/src/fns.c Tue Nov 02 20:19:39 2010 +0100
+++ b/src/fns.c Sat Nov 06 14:51:13 2010 +0000
@@ -345,6 +345,7 @@
DEFUN ("list-length", Flist_length, 1, 1, 0, /*
Return the length of LIST. Return nil if LIST is circular.
+Error if LIST is dotted.
*/
(list))
{
@@ -357,6 +358,11 @@
{
if (len & 1)
tortoise = XCDR (tortoise);
+ }
+
+ if (!LISTP (hare))
+ {
+ signal_malformed_list_error (list);
}
return EQ (hare, tortoise) && len != 0 ? Qnil : make_int (len);
diff -r 99006e0b3a84 -r 28651c24b3f8 tests/ChangeLog
--- a/tests/ChangeLog Tue Nov 02 20:19:39 2010 +0100
+++ b/tests/ChangeLog Sat Nov 06 14:51:13 2010 +0000
@@ -1,3 +1,8 @@
+2010-11-06 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/lisp-tests.el (malformed-list): Check that #'mapcar,
+ #'map and #'list-length throw this error when appropriate.
+
2010-10-25 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
diff -r 99006e0b3a84 -r 28651c24b3f8 tests/automated/lisp-tests.el
--- a/tests/automated/lisp-tests.el Tue Nov 02 20:19:39 2010 +0100
+++ b/tests/automated/lisp-tests.el Sat Nov 06 14:51:13 2010 +0000
@@ -1039,6 +1039,12 @@
(car (mapcar #'(lambda (argument) (floor argument)) (list pi e)))))
1)
"checking multiple values are correctly discarded in mapcar")
+
+(let ((malformed-list '(1 2 3 4 hi there . tail)))
+ (Check-Error malformed-list (mapcar #'identity malformed-list))
+ (Check-Error malformed-list (map nil #'eq [1 2 3 4]
+ malformed-list))
+ (Check-Error malformed-list (list-length malformed-list)))
;;-----------------------------------------------------
;; Test vector functions
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches