ruby-changes:10275
From: yugui <ko1@a...>
Date: Wed, 28 Jan 2009 18:22:21 +0900 (JST)
Subject: [ruby-changes:10275] Ruby:r21820 (ruby_1_9_1): merges the 1/2 of r21727 from trunk into ruby_1_9_1.
yugui 2009-01-28 18:21:08 +0900 (Wed, 28 Jan 2009) New Revision: 21820 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21820 Log: merges the 1/2 of r21727 from trunk into ruby_1_9_1. * gc.c (define_final): cannot define finalizer for immediate values. [ruby-core:21500] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/gc.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 21819) +++ ruby_1_9_1/ChangeLog (revision 21820) @@ -1,3 +1,8 @@ +Thu Jan 22 12:19:29 2009 Nobuyoshi Nakada <nobu@r...> + + * gc.c (define_final): cannot define finalizer for immediate + values. [ruby-core:21500] + Thu Jan 22 11:33:08 2009 Nobuyoshi Nakada <nobu@r...> * thread.c (rb_time_timeval): made a real prototype. a patch from Index: ruby_1_9_1/gc.c =================================================================== --- ruby_1_9_1/gc.c (revision 21819) +++ ruby_1_9_1/gc.c (revision 21820) @@ -2290,9 +2290,14 @@ rb_raise(rb_eArgError, "wrong type argument %s (should be callable)", rb_obj_classname(block)); } - FL_SET(obj, FL_FINALIZE); + if (!FL_ABLE(obj)) { + rb_raise(rb_eArgError, "cannot define finalizer for %s", + rb_obj_classname(obj)); + } + RBASIC(obj)->flags |= FL_FINALIZE; block = rb_ary_new3(2, INT2FIX(rb_safe_level()), block); + OBJ_FREEZE(block); if (!finalizer_table) { finalizer_table = st_init_numtable(); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/