GNU bug report logs -
#80154
odd max-lisp-eval-depth overrun error
Previous Next
To reply to this bug, email your comments to 80154 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80154; Package
emacs.
(Thu, 08 Jan 2026 16:03:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mattias Engdegård <mattias.engdegard <at> gmail.com>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Thu, 08 Jan 2026 16:03:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Emacs master (804f965577): first define
(defun triangle (x) (if (zerop x) 0 (+ x (triangle (1- x)))))
and evaluate
(triangle 1000)
I get:
Entering debugger...
Lisp nesting exceeds ‘max-lisp-eval-depth’
Maybe we should have tried harder to enter the debugger (lifting max-lisp-eval-depth a bit higher, temporarily?) but I suppose it's not a big problem.
However, when evaluating (triangle 1000) again:
Entering debugger...
cl--generic-build-combined-method: Cyclic definition: cl-generic-generalizers
Where did that come from?
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80154; Package
emacs.
(Thu, 08 Jan 2026 17:09:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 80154 <at> debbugs.gnu.org (full text, mbox):
> Emacs master (804f965577): first define
>
> (defun triangle (x) (if (zerop x) 0 (+ x (triangle (1- x)))))
>
> and evaluate
>
> (triangle 1000)
>
> I get:
>
> Entering debugger...
> Lisp nesting exceeds ‘max-lisp-eval-depth’
>
> Maybe we should have tried harder to enter the debugger (lifting
> max-lisp-eval-depth a bit higher, temporarily?) but I suppose it's not
> a big problem.
> However, when evaluating (triangle 1000) again:
>
> Entering debugger...
> cl--generic-build-combined-method: Cyclic definition: cl-generic-generalizers
>
> Where did that come from?
I suspect the patch below fixes your problem.
Stefan
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 405500c0987..b8ac3e13d9a 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -872,7 +875,12 @@ cl--generic-build-combined-method
(puthash (cons generic methods) :cl--generic--under-construction
cl--generic-combined-method-memoization)
(condition-case nil
- (cl-generic-combine-methods generic methods)
+ (unwind-protect
+ (cl-generic-combine-methods generic methods)
+ ;; Don't let the `:cl--generic--under-construction' linger
+ ;; when `cl-generic-combine-methods' signals an error.
+ (puthash (cons generic methods) nil
+ cl--generic-combined-method-memoization))
;; Special case needed to fix a circularity during bootstrap.
(cl--generic-cyclic-definition
(cl--generic-standard-method-combination generic methods))))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80154; Package
emacs.
(Fri, 09 Jan 2026 10:35:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 80154 <at> debbugs.gnu.org (full text, mbox):
8 jan. 2026 kl. 18.08 skrev Stefan Monnier <monnier <at> iro.umontreal.ca>:
> I suspect the patch below fixes your problem.
It does, thank you!
Regarding the lack of debugger backtrace in this case, we enter `debug` via `eval-expression--debug` called from `signal_or_quit` who generously supplied us with 20 credits lisp_eval_depth which isn't nearly enough here. Cf. `call_debugger`:
/* The previous value of 40 is too small now that the debugger
prints using cl-prin1 instead of prin1. Printing lists nested 8
deep (which is the value of print-level used in the debugger)
currently requires 77 additional frames. See bug#31919. */
max_ensure_room (100);
Apart from the inconsistency here, we should probably boost the headroom a lot more if we are at all serious about helping the user locate the source of runaway recursion.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80154; Package
emacs.
(Fri, 09 Jan 2026 16:23:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 80154 <at> debbugs.gnu.org (full text, mbox):
> Regarding the lack of debugger backtrace in this case, we enter `debug` via `eval-expression--debug` called from `signal_or_quit` who generously supplied us with 20 credits lisp_eval_depth which isn't nearly enough here.
Now fixed on master, in the time-honoured way of raising some limits and calling it a day.
With Stefan's cl-generic fix that should be it.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80154; Package
emacs.
(Fri, 09 Jan 2026 19:21:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 80154 <at> debbugs.gnu.org (full text, mbox):
> With Stefan's cl-generic fix that should be it.
I pushed a different patch which should also fix the problems (it did on
my end) but simplifies the code a bit, along the way.
Can you confirm that it also fixes it for you?
Stefan
Reply sent
to
Mattias Engdegård <mattias.engdegard <at> gmail.com>:
You have taken responsibility.
(Fri, 09 Jan 2026 20:49:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Mattias Engdegård <mattias.engdegard <at> gmail.com>:
bug acknowledged by developer.
(Fri, 09 Jan 2026 20:49:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 80154-done <at> debbugs.gnu.org (full text, mbox):
9 jan. 2026 kl. 20.19 skrev Stefan Monnier <monnier <at> iro.umontreal.ca>:
> I pushed a different patch which should also fix the problems (it did on
> my end) but simplifies the code a bit, along the way.
> Can you confirm that it also fixes it for you?
Confirmed. Nicer to avoid an unnecessary signal, I agree.
Closing!
This bug report was last modified 2 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.