diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-09 00:04:12 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-09 00:04:12 +0000 |
commit | 15fd3268a7274f9bb919bfe42eb663448bdb3969 (patch) | |
tree | 7331f81e3394e9ad2a740245d80c78f31604a35b | |
parent | d7bacd080ddbd891e99f32ac6b812a805c96ff01 (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_6@22832 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:03:01 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:52:37 2009 Yukihiro Matsumoto <matz@ruby-lang.org> * parse.y (IS_BEG): EXPR_CLASS should be treated like EXPR_BEG. @@ -1843,9 +1843,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(); @@ -1854,7 +1859,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 186 #define RUBY_RELEASE_CODE 20090309 -#define RUBY_PATCHLEVEL 356 +#define RUBY_PATCHLEVEL 357 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |