From 3202eea1a1f5acf939d79b382f118ecfddf2c393 Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 1 May 2011 09:37:08 +0000 Subject: * 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 --- ChangeLog | 8 ++++++++ test/ruby/test_thread.rb | 7 +++++++ thread.c | 5 +++++ version.h | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) 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) + + * 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 * 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 -- cgit v1.2.3