Subject: bug#46722: test-map-into fails

From: Stefan Monnier <[email-masked]>
Date: Sat, 15 Jan 2022 10:16:48 -0500

FWIW, I think installing the cl-generic patch into `emacs-28` would be
a much better option.  In my view it's "super safe" and it fixes
a nasty bug that can affect a lot of code (as we're witnessing here
with those test problems).

It admittedly doesn't fix a regression.

For reference the patch is just:

    diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
    index 983694204df..5090e060372 100644
    --- a/lisp/emacs-lisp/cl-generic.el
    +++ b/lisp/emacs-lisp/cl-generic.el
    @@ -604,7 +604,9 @@ cl--generic-dispatchers
     
     (defun cl--generic-get-dispatcher (dispatch)
       (with-memoization
    -      (gethash dispatch cl--generic-dispatchers)
    +      ;; We need `copy-sequence` here because this `dispatch' object might be
    +      ;; modified by side-effect in `cl-generic-define-method' (bug#46722).
    +      (gethash (copy-sequence dispatch) cl--generic-dispatchers)
         ;; (message "cl--generic-get-dispatcher (%S)" dispatch)
         (let* ((dispatch-arg (car dispatch))
                (generalizers (cdr dispatch))

It's already the second time I say it, so I promise it's the last time
I insist here.  I can live with either choice, but I'm sure Emacs-28 will
be better off with the patch than without.

        Stefan