Project

General

Profile

Backport #1547

Fiber#alive? Returns 0 for true on 1.9.1

Added by runpaint (Run Paint Run Run) about 10 years ago. Updated about 8 years ago.

Status:
Rejected
Priority:
Normal
[ruby-core:23649]

Description

=begin
When a Fiber is alive, Fiber#alive? returns 0 on 1.9.1; true on 1.9.2. The latter behaviour is consistent with the documentation.

$ ruby91 -rfiber -ve 'f=Fiber.new {1}; p f.alive?; f.resume; p f.alive?'
ruby 1.9.1p154 (2009-05-22 revision 23541) [i686-linux]
0
false

$ rubybleed -rfiber -ve 'f=Fiber.new {1}; p f.alive?; f.resume; p f.alive?'
ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux]
true
false

branches/ruby_1_9_1/cont.c:

rb_fiber_alive_p(VALUE fibval)
{
rb_fiber_t *fib;
GetFiberPtr(fibval, fib);
return fib->status != TERMINATED;
}

trunk/cont.c:

rb_fiber_alive_p(VALUE fibval)
{
rb_fiber_t *fib;
GetFiberPtr(fibval, fib);
return fib->status != TERMINATED ? Qtrue : Qfalse;
}
=end

History

#1

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Category set to core
  • Assignee set to yugui (Yuki Sonoda)

=begin

=end

#2

Updated by yugui (Yuki Sonoda) over 9 years ago

  • Status changed from Open to Rejected

=begin
It was probably a bug. but 0 is truth. I prefer not changing the behavior to fixing the bug.
=end

Also available in: Atom PDF