[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37888: 27.0.50; Streams and errors in element generation
From: |
Michael Heerdegen |
Subject: |
bug#37888: 27.0.50; Streams and errors in element generation |
Date: |
Wed, 23 Oct 2019 16:58:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Michael Heerdegen <michael_heerdegen@web.de> writes:
> (defun test-stream (n)
> (stream-cons n (if (< n 0) (error "test") (test-stream (1- n)))))
>
> (setq my-stream (test-stream 10))
>
> (condition-case nil (seq-length my-stream)
> (error (message "Hmm, didn't work so well")))
>
> Now, what happened to `my-stream' after evaluating this? If you try to
> use it, you get a quite confusing error:
>
> (seq-length my-stream)
>
> |-- stream--force: Wrong type argument: streamp, (((n . -1) t) nil ...)
Would something like this make sense (Noam)?
From 4c778f26ff8d56d0e7018305aa3d46caa2f9fb38 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Wed, 23 Oct 2019 16:55:01 +0200
Subject: [PATCH] WIP [stream] Fix Bug#37888
---
packages/stream/stream.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/stream/stream.el b/packages/stream/stream.el
index 9f73e8b861..d401fb7e3c 100644
--- a/packages/stream/stream.el
+++ b/packages/stream/stream.el
@@ -86,8 +86,8 @@ That value is the one passed to `stream-make'."
((eq (car-safe stream) stream--evald-identifier)
(cdr stream))
((eq (car-safe stream) stream--fresh-identifier)
- (setf (car stream) stream--evald-identifier)
- (setf (cdr stream) (funcall (cdr stream))))
+ (prog1 (setf (cdr stream) (funcall (cdr stream)))
+ (setf (car stream) stream--evald-identifier)))
(t (signal 'wrong-type-argument (list 'streamp stream)))))
(defmacro stream-cons (first rest)
--
2.23.0
Michael.