Project

General

Profile

Actions

Bug #16912

closed

Fiber#raise has a mismatch between implementation and documentation

Added by pocke (Masataka Kuwabara) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.8.0dev (2020-05-24T14:47:24Z master c6c023317c) [x86_64-linux]
[ruby-core:98511]

Description

Fiber#raise has a mismatch between implementation and documentation for "created" fiber.

RDoc:

Raises an exception in the fiber at the point at which the last Fiber.yield was called, or at the start if neither resume nor raise were called before.

https://docs.ruby-lang.org/en/2.7.0/Fiber.html#method-i-raise

If my understanding is correct, it says "Fiber#raise raises an exception at the beginning of the fiber if neither resume nor raise were called before.".

But actually it raises a FiberError. I've confirmed the behavior with both of master and v2.7.0.

$ ruby -ve 'Fiber.new{}.raise' 
ruby 2.8.0dev (2020-05-24T14:47:24Z master c6c023317c) [x86_64-linux]
-e:1:in `raise': cannot raise exception on unborn fiber (FiberError)
	from -e:1:in `<main>'

This error has been enabled since https://github.com/ruby/ruby/commit/9ee79b658123a2a4af65c80484d1f91ce73354e2.
And the implemented behavior is tested by
https://github.com/ruby/ruby/blob/d1251159e98d0cdb99bab953c8d520409e3255ed/test/ruby/test_fiber.rb#L113-L116.
So I guess the documentation is wrong.

Actions #1

Updated by jeremyevans (Jeremy Evans) over 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|faab5cbeb762adec4983d603d71e72add5108249.


Fix documentation for Fiber#raise [ci skip]

Fixes [Bug #16912]

Actions

Also available in: Atom PDF

Like0
Like0