From aa3dda8bcef6d053c07c1b60f61857f5b5e23b7c Mon Sep 17 00:00:00 2001 From: usa Date: Sun, 28 Feb 2021 14:01:55 +0000 Subject: merge revision(s) f72dc407: [Backport #16297] Prohibit calling undefined allocator [Bug #16297] --- object.c | 31 +++++++++++++++++++++++++++++-- test/ruby/test_class.rb | 8 ++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_class.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index ad2caeb8be..7903a7c178 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -232,6 +232,11 @@ class TestClass < Test::Unit::TestCase assert_raise(TypeError) { Class.allocate.superclass } bug6863 = '[ruby-core:47148]' assert_raise(TypeError, bug6863) { Class.new(Class.allocate) } + + allocator = Class.instance_method(:allocate) + assert_raise_with_message(TypeError, /prohibited/) { + allocator.bind(Rational).call + } end def test_nonascii_name -- cgit v1.2.3