diff options
| author | Stefan Monnier | 2026-03-08 23:26:58 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2026-03-10 00:13:31 -0400 |
| commit | ea5f15d09642435ecb645fc5dc7b84cc047ba8e6 (patch) | |
| tree | d007e08c463aaa3a9743ad81c567f760f0e1db8d | |
| parent | 3118a8c8b1a8d1a77de80da4b03c51c199c202f8 (diff) | |
| download | emacs-ea5f15d09642435ecb645fc5dc7b84cc047ba8e6.tar.gz emacs-ea5f15d09642435ecb645fc5dc7b84cc047ba8e6.zip | |
Fix `signal` calls where the data argument is not a list
* test/src/thread-tests.el (threads-join-error):
* test/src/emacs-module-resources/mod-test.c (Fmod_test_signal):
* src/print.c (print_bind_overrides):
* lisp/url/url-future.el (url-future-finish, url-future-errored)
(url-future-call, url-future-cancel): Make sure signal's data is a list.
* test/src/emacs-module-tests.el (mod-test-non-local-exit-signal-test):
Adjust accordingly.
| -rw-r--r-- | lisp/url/url-future.el | 8 | ||||
| -rw-r--r-- | src/print.c | 6 | ||||
| -rw-r--r-- | test/lisp/files-tests.el | 2 | ||||
| -rw-r--r-- | test/src/emacs-module-resources/mod-test.c | 10 | ||||
| -rw-r--r-- | test/src/emacs-module-tests.el | 2 | ||||
| -rw-r--r-- | test/src/thread-tests.el | 4 |
6 files changed, 19 insertions, 13 deletions
diff --git a/lisp/url/url-future.el b/lisp/url/url-future.el index 12dd60434cd..9f23bd126a2 100644 --- a/lisp/url/url-future.el +++ b/lisp/url/url-future.el | |||
| @@ -58,7 +58,7 @@ | |||
| 58 | 58 | ||
| 59 | (defun url-future-finish (url-future &optional status) | 59 | (defun url-future-finish (url-future &optional status) |
| 60 | (if (url-future-done-p url-future) | 60 | (if (url-future-done-p url-future) |
| 61 | (signal 'error 'url-future-already-done) | 61 | (signal 'error '(url-future-already-done)) |
| 62 | (setf (url-future-status url-future) (or status t)) | 62 | (setf (url-future-status url-future) (or status t)) |
| 63 | ;; the status must be such that the future was completed | 63 | ;; the status must be such that the future was completed |
| 64 | ;; to run the callback | 64 | ;; to run the callback |
| @@ -69,7 +69,7 @@ | |||
| 69 | 69 | ||
| 70 | (defun url-future-errored (url-future errorcons) | 70 | (defun url-future-errored (url-future errorcons) |
| 71 | (if (url-future-done-p url-future) | 71 | (if (url-future-done-p url-future) |
| 72 | (signal 'error 'url-future-already-done) | 72 | (signal 'error '(url-future-already-done)) |
| 73 | (setf (url-future-status url-future) 'error) | 73 | (setf (url-future-status url-future) 'error) |
| 74 | (setf (url-future-value url-future) errorcons) | 74 | (setf (url-future-value url-future) errorcons) |
| 75 | (funcall (or (url-future-errorback url-future) 'ignore) | 75 | (funcall (or (url-future-errorback url-future) 'ignore) |
| @@ -77,7 +77,7 @@ | |||
| 77 | 77 | ||
| 78 | (defun url-future-call (url-future) | 78 | (defun url-future-call (url-future) |
| 79 | (if (url-future-done-p url-future) | 79 | (if (url-future-done-p url-future) |
| 80 | (signal 'error 'url-future-already-done) | 80 | (signal 'error '(url-future-already-done)) |
| 81 | (let ((ff (url-future-value url-future))) | 81 | (let ((ff (url-future-value url-future))) |
| 82 | (when (functionp ff) | 82 | (when (functionp ff) |
| 83 | (condition-case catcher | 83 | (condition-case catcher |
| @@ -93,7 +93,7 @@ | |||
| 93 | 93 | ||
| 94 | (defun url-future-cancel (url-future) | 94 | (defun url-future-cancel (url-future) |
| 95 | (if (url-future-done-p url-future) | 95 | (if (url-future-done-p url-future) |
| 96 | (signal 'error 'url-future-already-done) | 96 | (signal 'error '(url-future-already-done)) |
| 97 | (url-future-finish url-future 'cancel))) | 97 | (url-future-finish url-future 'cancel))) |
| 98 | 98 | ||
| 99 | (define-obsolete-function-alias 'url-future-cancelled-p | 99 | (define-obsolete-function-alias 'url-future-cancelled-p |
diff --git a/src/print.c b/src/print.c index 17e271967cb..ef09b5fbc38 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -708,7 +708,7 @@ print_bind_overrides (Lisp_Object overrides) | |||
| 708 | if (EQ (overrides, Qt)) | 708 | if (EQ (overrides, Qt)) |
| 709 | print_bind_all_defaults (); | 709 | print_bind_all_defaults (); |
| 710 | else if (!CONSP (overrides)) | 710 | else if (!CONSP (overrides)) |
| 711 | xsignal (Qwrong_type_argument, Qconsp); | 711 | xsignal2 (Qwrong_type_argument, Qconsp, overrides); |
| 712 | else | 712 | else |
| 713 | { | 713 | { |
| 714 | while (!NILP (overrides)) | 714 | while (!NILP (overrides)) |
| @@ -717,7 +717,7 @@ print_bind_overrides (Lisp_Object overrides) | |||
| 717 | if (EQ (setting, Qt)) | 717 | if (EQ (setting, Qt)) |
| 718 | print_bind_all_defaults (); | 718 | print_bind_all_defaults (); |
| 719 | else if (!CONSP (setting)) | 719 | else if (!CONSP (setting)) |
| 720 | xsignal (Qwrong_type_argument, Qconsp); | 720 | xsignal2 (Qwrong_type_argument, Qconsp, setting); |
| 721 | else | 721 | else |
| 722 | { | 722 | { |
| 723 | Lisp_Object key = XCAR (setting), | 723 | Lisp_Object key = XCAR (setting), |
| @@ -729,7 +729,7 @@ print_bind_overrides (Lisp_Object overrides) | |||
| 729 | } | 729 | } |
| 730 | 730 | ||
| 731 | if (!NILP (XCDR (overrides)) && !CONSP (XCDR (overrides))) | 731 | if (!NILP (XCDR (overrides)) && !CONSP (XCDR (overrides))) |
| 732 | xsignal (Qwrong_type_argument, Qconsp); | 732 | xsignal2 (Qwrong_type_argument, Qconsp, overrides); |
| 733 | overrides = XCDR (overrides); | 733 | overrides = XCDR (overrides); |
| 734 | } | 734 | } |
| 735 | } | 735 | } |
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 14cfff99c59..e6b2a0eb078 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -1892,7 +1892,7 @@ Ensure that the issues from bug#66546 are fixed." | |||
| 1892 | (error err)) | 1892 | (error err)) |
| 1893 | 'missing)) | 1893 | 'missing)) |
| 1894 | (signal-write-failed (&rest _) | 1894 | (signal-write-failed (&rest _) |
| 1895 | (signal 'file-error "Write failed"))) | 1895 | (signal 'file-error '("Write failed")))) |
| 1896 | 1896 | ||
| 1897 | (let* (;; Sanitize environment. | 1897 | (let* (;; Sanitize environment. |
| 1898 | ;; The tests below test text for equality, so we need to | 1898 | ;; The tests below test text for equality, so we need to |
diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-module-resources/mod-test.c index d44af0e4d81..a5aeda0a666 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c | |||
| @@ -114,8 +114,14 @@ Fmod_test_signal (emacs_env *env, ptrdiff_t nargs, emacs_value args[], | |||
| 114 | void *data) | 114 | void *data) |
| 115 | { | 115 | { |
| 116 | assert (env->non_local_exit_check (env) == emacs_funcall_exit_return); | 116 | assert (env->non_local_exit_check (env) == emacs_funcall_exit_return); |
| 117 | env->non_local_exit_signal (env, env->intern (env, "error"), | 117 | emacs_value cargs[2] = { |
| 118 | env->make_integer (env, 56)); | 118 | env->make_integer (env, 56), |
| 119 | env->intern (env, "nil") | ||
| 120 | }; | ||
| 121 | env->non_local_exit_signal ( | ||
| 122 | env, env->intern (env, "error"), | ||
| 123 | env->funcall (env, env->intern (env, "cons"), | ||
| 124 | 2, cargs)); | ||
| 119 | return NULL; | 125 | return NULL; |
| 120 | } | 126 | } |
| 121 | 127 | ||
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index e34db70feb6..d2ec127f878 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el | |||
| @@ -121,7 +121,7 @@ changes." | |||
| 121 | (setq handler-err err | 121 | (setq handler-err err |
| 122 | backtrace (with-output-to-string (backtrace)))))) | 122 | backtrace (with-output-to-string (backtrace)))))) |
| 123 | (mod-test-signal))) | 123 | (mod-test-signal))) |
| 124 | (should (equal handler-err '(error . 56))) | 124 | (should (equal handler-err '(error 56))) |
| 125 | (should (string-match-p | 125 | (should (string-match-p |
| 126 | (rx bol " mod-test-signal()" eol) | 126 | (rx bol " mod-test-signal()" eol) |
| 127 | backtrace)))) | 127 | backtrace)))) |
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el index 9cbe1f3a1aa..c575f13b488 100644 --- a/test/src/thread-tests.el +++ b/test/src/thread-tests.el | |||
| @@ -122,10 +122,10 @@ | |||
| 122 | (skip-unless (featurep 'threads)) | 122 | (skip-unless (featurep 'threads)) |
| 123 | (let ((thread (make-thread #'threads-thread-sleeps)) | 123 | (let ((thread (make-thread #'threads-thread-sleeps)) |
| 124 | err) | 124 | err) |
| 125 | (thread-signal thread 'error "Error signal for thread") | 125 | (thread-signal thread 'error '("Error signal for thread")) |
| 126 | (thread-yield) | 126 | (thread-yield) |
| 127 | (setq err (should-error (thread-join thread))) | 127 | (setq err (should-error (thread-join thread))) |
| 128 | (should (equal err '(error . "Error signal for thread"))))) | 128 | (should (equal err '(error "Error signal for thread"))))) |
| 129 | 129 | ||
| 130 | (defvar threads-test-binding nil) | 130 | (defvar threads-test-binding nil) |
| 131 | 131 | ||