From 45175962a6fd74ab2e9ba92f1280f3987af25494 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Tue, 20 Dec 2022 17:59:46 +0100 Subject: Never use the storage of another Fiber, that violates the whole design * See https://bugs.ruby-lang.org/issues/19078#note-30 --- cont.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'cont.c') diff --git a/cont.c b/cont.c index 72331fcc93..a1cb4112d2 100644 --- a/cont.c +++ b/cont.c @@ -2185,9 +2185,6 @@ fiber_initialize(VALUE self, VALUE proc, struct fiber_pool * fiber_pool, unsigne // The default, inherit storage (dup) from the current fiber: storage = inherit_fiber_storage(); } - else if (storage == Qfalse) { - storage = current_fiber_storage(); - } else /* nil, hash, etc. */ { fiber_storage_validate(storage); storage = rb_obj_dup(storage); @@ -2299,18 +2296,6 @@ rb_fiber_initialize_kw(int argc, VALUE* argv, VALUE self, int kw_splat) * end.resume * Fiber[:x] # => 1 * - * If the storage is false, this function uses the current - * fiber's storage by reference. This is used for Enumerator to create - * hidden fiber. - * - * Fiber[:count] = 0 - * enumerator = Enumerator.new do |y| - * loop{y << (Fiber[:count] += 1)} - * end - * Fiber[:count] # => 0 - * enumerator.next # => 1 - * Fiber[:count] # => 1 - * * If the given storage is nil, this function will lazy * initialize the internal storage, which starts as an empty hash. * @@ -2322,7 +2307,7 @@ rb_fiber_initialize_kw(int argc, VALUE* argv, VALUE self, int kw_splat) * Otherwise, the given storage is used as the new fiber's storage, * and it must be an instance of Hash. * - * Explicitly using `storage: true/false` is currently experimental and may + * Explicitly using `storage: true` is currently experimental and may * change in the future. */ static VALUE -- cgit v1.2.1