ruby-changes:5021
From: matz <ko1@a...>
Date: Thu, 22 May 2008 05:50:29 +0900 (JST)
Subject: [ruby-changes:5021] matz - Ruby:r16514 (ruby_1_8): * proc.c (proc_dup): should copy safe_level from src proc
matz 2008-05-22 05:50:16 +0900 (Thu, 22 May 2008) New Revision: 16514 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/eval.c branches/ruby_1_8/version.h Log: * proc.c (proc_dup): should copy safe_level from src proc properly. a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com> http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=16514&r2=16513&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=16514&r2=16513&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/eval.c?r1=16514&r2=16513&diff_format=u Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 16513) +++ ruby_1_8/ChangeLog (revision 16514) @@ -1,3 +1,9 @@ +Thu May 22 05:45:30 2008 Yukihiro Matsumoto <matz@r...> + + * proc.c (proc_dup): should copy safe_level from src proc + properly. a patch from Keita Yamaguchi + <keita.yamaguchi at gmail.com> + Wed May 21 23:31:44 2008 Nobuyoshi Nakada <nobu@r...> * eval.c (rb_get_method_body, rb_alias, rb_eval): should not cache Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 16513) +++ ruby_1_8/version.h (revision 16514) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2008-05-21" +#define RUBY_RELEASE_DATE "2008-05-22" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20080521 +#define RUBY_RELEASE_CODE 20080522 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 5 -#define RUBY_RELEASE_DAY 21 +#define RUBY_RELEASE_DAY 22 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8/eval.c =================================================================== --- ruby_1_8/eval.c (revision 16513) +++ ruby_1_8/eval.c (revision 16514) @@ -8424,16 +8424,25 @@ * MISSING: documentation */ +#define PROC_TSHIFT (FL_USHIFT+1) +#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3) +#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT) + +static int proc_get_safe_level(VALUE); + static VALUE proc_dup(self) VALUE self; { struct BLOCK *orig, *data; VALUE bind; + int safe = proc_get_safe_level(self); Data_Get_Struct(self, struct BLOCK, orig); bind = Data_Make_Struct(rb_obj_class(self),struct BLOCK,blk_mark,blk_free,data); blk_dup(data, orig); + if (safe > PROC_TMAX) safe = PROC_TMAX; + FL_SET(bind, (safe << PROC_TSHIFT) & PROC_TMASK); return bind; } @@ -8537,10 +8546,6 @@ return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */); } -#define PROC_TSHIFT (FL_USHIFT+1) -#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3) -#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT) - #define SAFE_LEVEL_MAX PROC_TMASK static void -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/