GNU bug report logs - #54079
29.0.50; Method dispatching eratically fails

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Mon, 21 Feb 2022 00:14:02 UTC

Severity: normal

Found in version 29.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Michael Heerdegen <michael_heerdegen <at> web.de>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: acm <at> muc.de, 54079 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: bug#54079: 29.0.50; Method dispatching eratically fails
Date: Sat, 5 Mar 2022 16:37:16 +0000
Hello, Michael.

On Fri, Mar 04, 2022 at 03:08:05 +0100, Michael Heerdegen wrote:
> Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> > This short recipe gives me the same error in emacs -Q:
> >
> > (byte-compile-file
> >  "/home/micha/software/emacs/lisp/emacs-lisp/cl-generic.el")
> > (require 'gnus-search)

> Small addition: it seems that all issues mentioned disappear when I
> avoid any byte compilation in my session.  Compilation of `defstruct's
> seems to be the culprit (hypothesis).

> Would be good to fix this problem not too late.  I think it will
> irritate or distract other people, too.

I think this problem can only happen for defuns/defvars/defconts inside
eval-when-compile or eval-and-compile.

Would you try out the following patch, please, which I believe fixes the
bug.

Thanks!



diff --git a/src/data.c b/src/data.c
index 1526cc0c73..0854b4efb4 100644
--- a/src/data.c
+++ b/src/data.c
@@ -942,6 +942,13 @@ The return value is undefined.  */)
   (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
 {
   CHECK_SYMBOL (symbol);
+  /* If we're in a byte compilation, ensure the definition's symbols
+     are stripped of their positions. */
+  if (symbols_with_pos_enabled
+      && SYMBOL_WITH_POS_P (symbol)
+      && Ffboundp (Qbyte_run_strip_symbol_positions))
+    call1 (Qbyte_run_strip_symbol_positions, definition);
+
   if (!NILP (Vpurify_flag)
       /* If `definition' is a keymap, immutable (and copying) is wrong.  */
       && !KEYMAPP (definition))
@@ -4352,6 +4359,8 @@ This variable cannot be set; trying to do so will signal an error.  */);
 Bind this to non-nil in applications such as the byte compiler.  */);
   symbols_with_pos_enabled = false;
 
+  DEFSYM (Qbyte_run_strip_symbol_positions, "byte-run-strip-symbol-positions");
+
   DEFSYM (Qwatchers, "watchers");
   DEFSYM (Qmakunbound, "makunbound");
   DEFSYM (Qunlet, "unlet");
diff --git a/src/eval.c b/src/eval.c
index 294d79e67a..1b1fde3a20 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -794,6 +794,12 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
       if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail))))
 	error ("Too many arguments");
       Lisp_Object exp = XCAR (tail);
+      /* If we're in a byte compilation, ensure the definition's
+	 symbols are stripped of their positions. */
+      if (symbols_with_pos_enabled
+	  && SYMBOL_WITH_POS_P (sym)
+	  && Ffboundp (Qbyte_run_strip_symbol_positions))
+	call1 (Qbyte_run_strip_symbol_positions, exp);
 
       tem = Fdefault_boundp (sym);
       tail = XCDR (tail);
@@ -861,6 +867,14 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
     }
 
   Finternal__define_uninitialized_variable (sym, docstring);
+
+  /* If we're in a byte compilation, ensure the definition's symbols
+     are stripped of their positions. */
+  if (symbols_with_pos_enabled
+      && SYMBOL_WITH_POS_P (sym)
+      && Ffboundp (Qbyte_run_strip_symbol_positions))
+    call1 (Qbyte_run_strip_symbol_positions, XCAR (XCDR (args)));
+
   tem = eval_sub (XCAR (XCDR (args)));
   if (!NILP (Vpurify_flag))
     tem = Fpurecopy (tem);


> Michael.


-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 3 years and 67 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.