help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to debug erratic specializer behavior of generic functions


From: Stefan Monnier
Subject: Re: How to debug erratic specializer behavior of generic functions
Date: Sun, 20 Feb 2022 18:56:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> Any hints for where to dig, how to debug, or what could be involved?  So
> far I have nothing for emacs -Q, no recipe, that demonstrates the
> behavior (that's why I chose to ask here first before starting a bug
> report).

If you're seeing this with Emacs's code on `master`, then please report
it as a bug.  If you're seeing it with Emacs < 29, then
I suggest you try the patch below.


        Stefan


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))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]