From: Nikodemus Siivola Date: Thu, 14 Oct 2010 19:36:59 +0000 (+0000) Subject: 1.0.43.59: fix DEFSETF to reject non-symbols as functions names X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=cc24446c5ba765a69c0465832f1ed43227fccd47;p=sbcl.git 1.0.43.59: fix DEFSETF to reject non-symbols as functions names The short form of DEFSETF requires the second argument to be a symbol. Added the appropriate check and a test case. See also the section 5.3 in CLHS. Patch by Roman Marynchak. --- diff --git a/src/code/early-setf.lisp b/src/code/early-setf.lisp index da208b9..ddd4755 100644 --- a/src/code/early-setf.lisp +++ b/src/code/early-setf.lisp @@ -393,7 +393,7 @@ GET-SETF-EXPANSION directly." #!+sb-doc "Associates a SETF update function or macro with the specified access function or macro. The format is complex. See the manual for details." - (cond ((not (listp (car rest))) + (cond ((and (not (listp (car rest))) (symbolp (car rest))) `(eval-when (:load-toplevel :compile-toplevel :execute) (assign-setf-macro ',access-fn nil diff --git a/tests/setf.impure.lisp b/tests/setf.impure.lisp index cd13d8d..b34349a 100644 --- a/tests/setf.impure.lisp +++ b/tests/setf.impure.lisp @@ -100,4 +100,11 @@ (assert (equal `(funcall #'(setf foo) ,@stores 1 2 3) set)) (assert (equal '(foo 1 2 3) get)))) +(with-test (:name :update-fn-should-be-a-symbol-in-defsetf) + (assert (eq :error + (handler-case + (eval '(defsetf access-fn 5)) + (error () + :error))))) + ;;; success diff --git a/version.lisp-expr b/version.lisp-expr index cef832a..bfc1939 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.43.58" +"1.0.43.59"