diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-03 06:57:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-03 06:57:44 +0000 |
commit | 60f0e763a41636dd9284d4c0d56116fb7dfaae7d (patch) | |
tree | 42f96adb142f2df430516b702abf0bcb9ebf3822 /test/ruby/test_method.rb | |
parent | c7770f90bdcac04dad43ab38bef9c415433597cb (diff) |
proc.c: fix segfault when no singleton class
* proc.c (rb_obj_singleton_method): bail out if the receiver does
not have the singleton class without accessing the origin class
not to segfault. [Bug #14658]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 67c24a8fd8..fe0171dd57 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -790,6 +790,9 @@ class TestMethod < Test::Unit::TestCase class << o; prepend Module.new; end m = assert_nothing_raised(NameError, bug14658) {o.singleton_method(:bar)} assert_equal(:bar, m.call, bug14658) + + o = Object.new + assert_raise(NameError, bug14658) {o.singleton_method(:bar)} end Feature9783 = '[ruby-core:62212] [Feature #9783]' |