GNU bug report logs - #28725
26.0.60; Error when using Edebug on a generator

Previous Next

Package: emacs;

Reported by: Gemini Lasswell <gazally <at> runbox.com>

Date: Fri, 6 Oct 2017 19:21:01 UTC

Severity: normal

Tags: confirmed

Merged with 40434

Found in versions 26.0.60, 27.0.90

To reply to this bug, email your comments to 28725 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28725; Package emacs. (Fri, 06 Oct 2017 19:21:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gemini Lasswell <gazally <at> runbox.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 06 Oct 2017 19:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gemini Lasswell <gazally <at> runbox.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.60; Error when using Edebug on a generator
Date: Fri, 06 Oct 2017 12:19:44 -0700
Running a generator under Edebug results in an error message when it
gets to iter-yield.

To reproduce, put the code below into *scratch* and:

M-x edebug-all-defs RET
M-x eval-buffer RET
M-: (my-iter-do) RET
g

Result: Symbol’s function definition is void: cps-internal-yield


;;;  -*- lexical-binding: t -*-

(iter-defun mycounter (start)
  (let* ((i start))
    (while t
      (iter-yield i)
      (setq i (1+ i)))))

(defun my-iter-do ()
  (let (results
	(tally (mycounter 10)))
    (dotimes (_ 4)
      (push (iter-next tally) results))
    results))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28725; Package emacs. (Fri, 27 Oct 2017 19:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 28725 <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: 28725 <at> debbugs.gnu.org
Subject: alternative
Date: Fri, 27 Oct 2017 21:35:56 +0200
You may want to try `iter2' package, which is a fully compatible
reimplementation of `generator'. Among other advantages, generator
functions it produces are compatible with Edebug. However, it's not
well-established, so be aware of possible misbehaving generators.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28725; Package emacs. (Sat, 28 Oct 2017 21:20:01 GMT) Full text and rfc822 format available.

Message #11 received at 28725 <at> debbugs.gnu.org (full text, mbox):

From: Gemini Lasswell <gazally <at> runbox.com>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 28725 <at> debbugs.gnu.org
Subject: Re: bug#28725: alternative
Date: Sat, 28 Oct 2017 14:18:50 -0700
Paul Pogonyshev <pogonyshev <at> gmail.com> writes:

> You may want to try `iter2' package, which is a fully compatible
> reimplementation of `generator'. Among other advantages, generator
> functions it produces are compatible with Edebug.

Hi Paul,

Thanks for letting me know about iter2 and it's good to hear that it
works with Edebug. My interest in this bug is more about Edebug than
it is about generators, because I've been working on finding and
fixing code that ships with Emacs but doesn't work with Edebug.

Best,
Gemini





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28725; Package emacs. (Sun, 20 Oct 2019 21:47:02 GMT) Full text and rfc822 format available.

Message #14 received at 28725 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gemini Lasswell <gazally <at> runbox.com>
Cc: 28725 <at> debbugs.gnu.org
Subject: Re: bug#28725: 26.0.60; Error when using Edebug on a generator
Date: Sun, 20 Oct 2019 23:45:57 +0200
Gemini Lasswell <gazally <at> runbox.com> writes:

> Running a generator under Edebug results in an error message when it
> gets to iter-yield.
>
> To reproduce, put the code below into *scratch* and:
>
> M-x edebug-all-defs RET
> M-x eval-buffer RET
> M-: (my-iter-do) RET
> g
>
> Result: Symbol’s function definition is void: cps-internal-yield

I'm able to reproduce this bug in Emacs 27.

Does anybody know what's causing this?  It's bugging out in the
`iter-yield' call.

> ;;;  -*- lexical-binding: t -*-
>
> (iter-defun mycounter (start)
>   (let* ((i start))
>     (while t
>       (iter-yield i)
>       (setq i (1+ i)))))
>
> (defun my-iter-do ()
>   (let (results
> 	(tally (mycounter 10)))
>     (dotimes (_ 4)
>       (push (iter-next tally) results))
>     results))

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




Added tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 20 Oct 2019 21:47:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28725; Package emacs. (Mon, 21 Oct 2019 16:30:02 GMT) Full text and rfc822 format available.

Message #19 received at 28725 <at> debbugs.gnu.org (full text, mbox):

From: Gemini Lasswell <gazally <at> runbox.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28725 <at> debbugs.gnu.org
Subject: Re: bug#28725: 26.0.60; Error when using Edebug on a generator
Date: Mon, 21 Oct 2019 09:29:04 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I'm able to reproduce this bug in Emacs 27.
>
> Does anybody know what's causing this?  It's bugging out in the
> `iter-yield' call.

I took a look and I think the problem is that cps--transform-1 doesn't
look inside lambda forms.  When Edebug instruments a function, it wraps
the body of the function in a lambda form.

Here's a code sample to reproduce the bug with just eval-buffer, no
Edebug necessary:

;;;  -*- lexical-binding: t -*-

(require 'generator)

(iter-defun mycounter (start)
  (let ((i 0)
	(offset-yield-func (lambda (x) (iter-yield (+ x start)))))
    (while t
      (funcall offset-yield-func i)
      (setq i (1+ i)))))

(defun my-iter-do ()
  (let (results
	(tally (mycounter 10)))
    (dotimes (_ 4)
      (push (iter-next tally) results))
    results))

(my-iter-do)





Forcibly Merged 28725 40434. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 30 Sep 2020 03:53:02 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 261 days ago.

Previous Next


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