summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-01 09:37:08 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-01 09:37:08 +0000
commit3202eea1a1f5acf939d79b382f118ecfddf2c393 (patch)
tree033c281fa09d038210732b07f7aa3c6aca0efcc0
parent0ca24ab21d507f4fd3130874e3b0c2902e72cf90 (diff)
* thread.c (thread_s_kill): workaround for [ruby-core:35086].
fixes #4367. * test/ruby/test_thread.rb (TestThread#test_kill_wrong_argument): test for [ruby-core:35086]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--test/ruby/test_thread.rb7
-rw-r--r--thread.c5
-rw-r--r--version.h2
4 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f04a4f35b3..2a15e80f96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Apr 6 21:25:08 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * thread.c (thread_s_kill): workaround for [ruby-core:35086].
+ fixes #4367.
+
+ * test/ruby/test_thread.rb (TestThread#test_kill_wrong_argument):
+ test for [ruby-core:35086].
+
Fri Feb 4 12:11:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* string.c (str_utf8_nth): fixed a conditon of optimized lead
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index b8c507a73e..179af08341 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -300,6 +300,13 @@ class TestThread < Test::Unit::TestCase
INPUT
end
+ def test_kill_wrong_argument
+ bug4367 = '[ruby-core:35086]'
+ assert_raise(TypeError, bug4367) {
+ Thread.kill(nil)
+ }
+ end
+
def test_exit
s = 0
Thread.new do
diff --git a/thread.c b/thread.c
index 09a9f94fac..669c7bdd65 100644
--- a/thread.c
+++ b/thread.c
@@ -1509,6 +1509,11 @@ rb_thread_kill(VALUE thread)
static VALUE
rb_thread_s_kill(VALUE obj, VALUE th)
{
+ if (CLASS_OF(th) != rb_cThread) {
+ rb_raise(rb_eTypeError,
+ "wrong argument type %s (expected Thread)",
+ rb_obj_classname(th));
+ }
return rb_thread_kill(th);
}
diff --git a/version.h b/version.h
index d05f4da128..5aab22e837 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 189
+#define RUBY_PATCHLEVEL 190
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1