diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-09 00:05:03 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-09 00:05:03 +0000 |
commit | 0b85e2a0a7d95a7572fff1650d0217d66d7defda (patch) | |
tree | 111f6c70763de59fd2d88381ad817d9a9ddf1642 | |
parent | 2d281863caef13ca12530822f682d174f833cee6 (diff) |
merge revision(s) 21727:
* gc.c (define_final): cannot define finalizer for immediate
values. [ruby-core:21500]
* gc.c (define_final): freezes or hides internal values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@22834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | gc.c | 11 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 17 insertions, 3 deletions
@@ -1,3 +1,10 @@ +Mon Mar 9 09:04:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * gc.c (define_final): cannot define finalizer for immediate + values. [ruby-core:21500] + + * gc.c (define_final): freezes or hides internal values. + Mon Mar 9 08:54:47 2009 Yukihiro Matsumoto <matz@ruby-lang.org> * parse.y (IS_BEG): EXPR_CLASS should be treated like EXPR_BEG. @@ -1887,9 +1887,14 @@ define_final(argc, argv, os) rb_obj_classname(block)); } need_call_final = 1; - 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(ruby_safe_level), block); + OBJ_FREEZE(block); if (!finalizer_table) { finalizer_table = st_init_numtable(); @@ -1898,7 +1903,9 @@ define_final(argc, argv, os) rb_ary_push(table, block); } else { - st_add_direct(finalizer_table, obj, rb_ary_new3(1, block)); + table = rb_ary_new3(1, block); + RBASIC(table)->klass = 0; + st_add_direct(finalizer_table, obj, table); } return block; } @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2009-03-09" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20090309 -#define RUBY_PATCHLEVEL 145 +#define RUBY_PATCHLEVEL 146 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |