diff options
| author | Glenn Morris | 2016-12-10 18:58:24 -0800 |
|---|---|---|
| committer | Glenn Morris | 2016-12-10 18:58:24 -0800 |
| commit | ba8e883fa30f1267c27751c1ee9df25a5dde4c0c (patch) | |
| tree | db838795f653937c63996857babbe636b1d106d6 | |
| parent | 010733616543f86aed9e351d5754d02864c2ea26 (diff) | |
| download | emacs-ba8e883fa30f1267c27751c1ee9df25a5dde4c0c.tar.gz emacs-ba8e883fa30f1267c27751c1ee9df25a5dde4c0c.zip | |
Do not allow nil to be defined as a function
* lisp/emacs-lisp/byte-run.el (defun):
* src/data.c (Ffset): Do not allow "nil". (Bug#25110)
| -rw-r--r-- | lisp/emacs-lisp/byte-run.el | 1 | ||||
| -rw-r--r-- | src/data.c | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 69b4f41fef6..9d2a048f365 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el | |||
| @@ -240,6 +240,7 @@ The return value is undefined. | |||
| 240 | ;; from | 240 | ;; from |
| 241 | ;; (defun foo (arg) (toto)). | 241 | ;; (defun foo (arg) (toto)). |
| 242 | (declare (doc-string 3) (indent 2)) | 242 | (declare (doc-string 3) (indent 2)) |
| 243 | (or name (error "Cannot define '%s' as a function" name)) | ||
| 243 | (if (null | 244 | (if (null |
| 244 | (and (listp arglist) | 245 | (and (listp arglist) |
| 245 | (null (delq t (mapcar #'symbolp arglist))))) | 246 | (null (delq t (mapcar #'symbolp arglist))))) |
diff --git a/src/data.c b/src/data.c index 09d94f57a8e..52cfe4ae4a3 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -733,6 +733,9 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | |||
| 733 | { | 733 | { |
| 734 | register Lisp_Object function; | 734 | register Lisp_Object function; |
| 735 | CHECK_SYMBOL (symbol); | 735 | CHECK_SYMBOL (symbol); |
| 736 | /* Perhaps not quite the right error signal, but seems good enough. */ | ||
| 737 | if (NILP (symbol)) | ||
| 738 | xsignal1 (Qsetting_constant, symbol); | ||
| 736 | 739 | ||
| 737 | function = XSYMBOL (symbol)->function; | 740 | function = XSYMBOL (symbol)->function; |
| 738 | 741 | ||