From bd4364acb13fbf03e80dcf83a5e3b5d29410b0cc Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 8 Dec 2015 16:44:45 +0000 Subject: merge revision(s) 52856,52906: [Backport #11760] * encoding.c (enc_m_loader): defer finding encoding object not to be infected by marshal source. [ruby-core:71793] [Bug #11760] * marshal.c (r_object0): enable compatible loader on USERDEF class. the loader function is called with the class itself, instead of an allocated object, and the loaded data. * marshal.c (compat_allocator_table): intialize compat_allocator_tbl on demand. * object.c (rb_undefined_alloc): extract from rb_obj_alloc. * marshal.c (compat_allocator_table): initialize git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- object.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'object.c') diff --git a/object.c b/object.c index d771e1e115..fe7b6f9be8 100644 --- a/object.c +++ b/object.c @@ -1771,6 +1771,13 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass) return klass; } +void +rb_undefined_alloc(VALUE klass) +{ + rb_raise(rb_eTypeError, "allocator undefined for %"PRIsVALUE, + klass); +} + /* * call-seq: * class.allocate() -> obj @@ -1807,8 +1814,7 @@ rb_obj_alloc(VALUE klass) } allocator = rb_get_alloc_func(klass); if (!allocator) { - rb_raise(rb_eTypeError, "allocator undefined for %"PRIsVALUE, - klass); + rb_undefined_alloc(klass); } #if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED -- cgit v1.2.3