ruby-changes:65220
From: Jeremy <ko1@a...>
Date: Thu, 11 Feb 2021 00:56:13 +0900 (JST)
Subject: [ruby-changes:65220] fc83b4896e (master): Don't document that Thread#group can return nil
https://git.ruby-lang.org/ruby.git/commit/?id=fc83b4896e From fc83b4896e9d7de084b203b133b84c1209c6ad88 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Tue, 9 Feb 2021 14:15:31 -0800 Subject: Don't document that Thread#group can return nil Thread's are assigned a group at initialization, and no API exists for them to unassign them from a group without assigning them to another group. Fixes [Bug #17505] --- thread.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/thread.c b/thread.c index 1e35ad4..c600a87 100644 --- a/thread.c +++ b/thread.c @@ -3213,8 +3213,7 @@ rb_thread_report_exc_set(VALUE thread, VALUE val) https://github.com/ruby/ruby/blob/trunk/thread.c#L3213 * call-seq: * thr.group -> thgrp or nil * - * Returns the ThreadGroup which contains the given thread, or returns +nil+ - * if +thr+ is not a member of any group. + * Returns the ThreadGroup which contains the given thread. * * Thread.main.group #=> #<ThreadGroup:0x4029d914> */ @@ -3222,8 +3221,7 @@ rb_thread_report_exc_set(VALUE thread, VALUE val) https://github.com/ruby/ruby/blob/trunk/thread.c#L3221 VALUE rb_thread_group(VALUE thread) { - VALUE group = rb_thread_ptr(thread)->thgroup; - return group == 0 ? Qnil : group; + return rb_thread_ptr(thread)->thgroup; } static const char * @@ -4974,10 +4972,6 @@ thgroup_add(VALUE group, VALUE thread) https://github.com/ruby/ruby/blob/trunk/thread.c#L4972 rb_raise(rb_eThreadError, "can't move to the enclosed thread group"); } - if (!target_th->thgroup) { - return Qnil; - } - if (OBJ_FROZEN(target_th->thgroup)) { rb_raise(rb_eThreadError, "can't move from the frozen thread group"); } -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/