Subject: bug#18966: 25.0.50; unhelpful error message from byte compiler

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 21 Aug 2020 13:20:01 +0200

Andreas Schwab <[email-masked]> writes:

> On Aug 20 2020, Lars Ingebrigtsen wrote:
>
>> Like in bug#35186, I'm not able to actually chase down where this error
>> message comes from.
>
> It's just a generic macro expansion error:
>
> ELISP> (macroexpand '(push zzz))
> *** Eval error ***  Wrong number of arguments: (2 . 2), 1
> ELISP> (push zzz)
> *** Eval error ***  Wrong number of arguments: (2 . 2), 1

Hm...  I grepped through *.c for the error, and the place where it seems
to actually trigger in the test case:

./src/emacs -Q --batch -f batch-byte-compile /tmp/t.el 
-> /tmp/t.el:3:1: Error: Wrong number of arguments: (2 . 2), 1

Is here:

Lisp_Object
exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
		Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args)
{
[...]
      if (! (mandatory <= nargs && nargs <= maxargs))
	Fsignal (Qwrong_number_of_arguments,
		 list2 (Fcons (make_fixnum (mandatory), make_fixnum (nonrest)),
			make_fixnum (nargs)));

Which seems odd -- you'd expect it to bug out much earlier, in
macroexpand, as Andreas says.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no