[#32009] merging nokogiri to ext/ — Aaron Patterson <aaron@...>

I would like to merge nokogiri to ext for the 1.9.3 release. I spoke to

82 messages 2010/09/02
[#32010] Re: merging nokogiri to ext/ — "U.Nakamura" <usa@...> 2010/09/02

Hello,

[#32012] Re: merging nokogiri to ext/ — Ryan Davis <ryand-ruby@...> 2010/09/02

[#32030] Re: merging nokogiri to ext/ — "NARUSE, Yui" <naruse@...> 2010/09/03

Hi,

[#32033] Re: merging nokogiri to ext/ — "NARUSE, Yui" <naruse@...> 2010/09/03

2010/9/3 NARUSE, Yui <naruse@airemix.jp>:

[#32155] Re: merging nokogiri to ext/ — Yusuke ENDOH <mame@...> 2010/09/08

Currently, we're discussing three different topics:

[#32189] Re: merging nokogiri to ext/ — Aaron Patterson <aaron@...> 2010/09/09

On Thu, Sep 09, 2010 at 01:40:34AM +0900, Yusuke ENDOH wrote:

[#32056] [Ruby 1.8-Bug#3788][Open] URI cannot parse IPv6 addresses propertly — Adam Majer <redmine@...>

Bug #3788: URI cannot parse IPv6 addresses propertly

16 messages 2010/09/04

[#32110] Ruby 2.0 Wiki/Wish-list? — Joshua Ballanco <jballanc@...>

Hi all,

41 messages 2010/09/07
[#32114] Re: Ruby 2.0 Wiki/Wish-list? — "NARUSE, Yui" <naruse@...> 2010/09/08

2010/9/8 Joshua Ballanco <jballanc@gmail.com>:

[#32117] Re: Ruby 2.0 Wiki/Wish-list? — Joshua Ballanco <jballanc@...> 2010/09/08

On Sep 7, 2010, at 5:21 PM, NARUSE, Yui wrote:

[#32143] Re: Ruby 2.0 Wiki/Wish-list? — Roger Pack <rogerdpack2@...> 2010/09/08

> So, for example, a few things I've wanted for a long time:

[#32135] [Ruby-Bug#3802][Open] freeaddrinfo not found in WS2_32.dll — Thomas Volkmar Worm <redmine@...>

Bug #3802: freeaddrinfo not found in WS2_32.dll

16 messages 2010/09/08

[#32154] Making custom_lambda() work — Magnus Holm <judofyr@...>

A tiny suggestion for how we could make it possible to call lambdas

15 messages 2010/09/08
[#32159] Re: Making custom_lambda() work — Nikolai Weibull <now@...> 2010/09/08

On Wed, Sep 8, 2010 at 18:21, Magnus Holm <judofyr@gmail.com> wrote:

[#32156] Can we convert the standard library to gems? — James Edward Gray II <james@...>

Taken from the bundle Nokogiri thread:

98 messages 2010/09/08
[#32161] Re: Can we convert the standard library to gems? — Marcus Rueckert <darix@...> 2010/09/08

On 2010-09-09 01:45:43 +0900, James Edward Gray II wrote:

[#32166] Re: Can we convert the standard library to gems? — James Edward Gray II <james@...> 2010/09/08

On Sep 8, 2010, at 12:03 PM, Marcus Rueckert wrote:

[#32173] Re: Can we convert the standard library to gems? — Marcus Rueckert <darix@...> 2010/09/08

On 2010-09-09 02:54:26 +0900, James Edward Gray II wrote:

[#32249] Re: Can we convert the standard library to gems? — Aaron Patterson <aaron@...> 2010/09/09

On Thu, Sep 09, 2010 at 05:26:54AM +0900, Marcus Rueckert wrote:

[#32278] Re: Can we convert the standard library to gems? — Lucas Nussbaum <lucas@...> 2010/09/10

On 10/09/10 at 02:41 +0900, Aaron Patterson wrote:

[#32162] Re: Can we convert the standard library to gems? — Yusuke ENDOH <mame@...> 2010/09/08

Hi,

[#32216] Re: Can we convert the standard library to gems? — Ryan Davis <ryand-ruby@...> 2010/09/09

[#32229] Re: Can we convert the standard library to gems? — Yusuke ENDOH <mame@...> 2010/09/09

Hi,

[#32260] Re: Can we convert the standard library to gems? — Ryan Davis <ryand-ruby@...> 2010/09/09

[#32275] Re: Can we convert the standard library to gems? — Urabe Shyouhei <shyouhei@...> 2010/09/10

I'm off today so sorry if I missed some mails.

[#32293] Re: Can we convert the standard library to gems? — James Cox <james@...> 2010/09/10

Urabe,

[#32316] Re: Can we convert the standard library to gems? — Urabe Shyouhei <shyouhei@...> 2010/09/11

(2010/09/10 23:48), James Cox wrote:

[#32322] Re: Can we convert the standard library to gems? — James Tucker <jftucker@...> 2010/09/11

[#32335] Re: Can we convert the standard library to gems? — Urabe Shyouhei <shyouhei@...> 2010/09/12

I'm at an airport back to my home so in short,

[#32343] Re: Can we convert the standard library to gems? — James Cox <james@...> 2010/09/12

On Sun, Sep 12, 2010 at 6:51 AM, Urabe Shyouhei <shyouhei@ruby-lang.org> wr=

[#32382] Re: Can we convert the standard library to gems? — Urabe Shyouhei <shyouhei@...> 2010/09/14

(2010/09/13 3:54), James Cox wrote:

[#32383] Re: Can we convert the standard library to gems? — James Cox <james@...> 2010/09/14

On Tue, Sep 14, 2010 at 12:37 PM, Urabe Shyouhei <shyouhei@ruby-lang.org> wrote:

[#32393] Re: Can we convert the standard library to gems? — Urabe Shyouhei <shyouhei@...> 2010/09/15

How difficult to make myself understood in English.

[#32396] Re: Can we convert the standard library to gems? — James Cox <james@...> 2010/09/15

On Wed, Sep 15, 2010 at 1:43 AM, Urabe Shyouhei <shyouhei@ruby-lang.org> wr=

[#32399] Re: Can we convert the standard library to gems? — Yusuke ENDOH <mame@...> 2010/09/15

Hi,

[#32400] Re: Can we convert the standard library to gems? — James Cox <james@...> 2010/09/15

On Wed, Sep 15, 2010 at 12:07 PM, Yusuke ENDOH <mame@tsg.ne.jp> wrote:

[#32401] Re: Can we convert the standard library to gems? — Marcus Rueckert <darix@...> 2010/09/15

On 2010-09-16 01:42:39 +0900, James Cox wrote:

[#32402] Re: Can we convert the standard library to gems? — James Cox <james@...> 2010/09/15

On Wed, Sep 15, 2010 at 1:35 PM, Marcus Rueckert <darix@opensu.se> wrote:

[#32411] Re: Can we convert the standard library to gems? — Marcus Rueckert <darix@...> 2010/09/15

On 2010-09-16 03:36:56 +0900, James Cox wrote:

[#32412] Re: Can we convert the standard library to gems? — James Cox <james@...> 2010/09/16

On Wednesday, September 15, 2010, Marcus Rueckert <darix@opensu.se> wrote:

[#32414] Re: Can we convert the standard library to gems? — Lucas Nussbaum <lucas@...> 2010/09/16

On 16/09/10 at 11:02 +0900, James Cox wrote:

[#32248] Replacing stdlib Date with C version — Jeremy Evans <code@...>

I've recently been working on a replacement for the stdlib Date class,

15 messages 2010/09/09

[#32290] [Ruby 1.9.2-Backport#3818][Open] Seg fault with ruby tmail and ruby 1.9.2 — Karl Baum <redmine@...>

Backport #3818: Seg fault with ruby tmail and ruby 1.9.2

10 messages 2010/09/10

[#32453] Why doesn’t Enumerable define a #last method? — Nikolai Weibull <now@...>

Hi!

9 messages 2010/09/17

[#32454] [Ruby 1.9-Feature#3845][Open] "in" infix operator — Yusuke Endoh <redmine@...>

Feature #3845: "in" infix operator

20 messages 2010/09/17
[#32489] Re: [Ruby 1.9-Feature#3845][Open] "in" infix operator — Benoit Daloze <eregontp@...> 2010/09/21

On 17 September 2010 12:30, Yusuke Endoh <redmine@ruby-lang.org> wrote:

[#32529] [Ruby 1.9-Bug#3869][Open] Logger#log does not handle or escape new-line characters. — Hal Brodigan <redmine@...>

Bug #3869: Logger#log does not handle or escape new-line characters.

9 messages 2010/09/23

[#32585] Proposal for Optional Static Typing for Ruby — Martin Pilkington <pilky@...>

Hi,

47 messages 2010/09/27
[#32588] Re: Proposal for Optional Static Typing for Ruby — Yukihiro Matsumoto <matz@...> 2010/09/27

Hi,

[#32592] Re: Proposal for Optional Static Typing for Ruby — Martin Pilkington <pilky@...> 2010/09/28

Hi Matz

[#32595] Re: Proposal for Optional Static Typing for Ruby — Asher <asher@...> 2010/09/28

Martin,

[#32611] Re: Proposal for Optional Static Typing for Ruby — Loren Segal <lsegal@...> 2010/09/28

Hi,

[#32628] Re: Proposal for Optional Static Typing for Ruby — Eleanor McHugh <eleanor@...> 2010/09/29

It strikes me that much of the premise behind this thread is misguided =

[#32634] [Ruby 1.9-Bug#3889][Open] Incorrectly detected i686-w64-mingw32 as x64-mingw — Luis Lavena <redmine@...>

Bug #3889: Incorrectly detected i686-w64-mingw32 as x64-mingw

21 messages 2010/09/29

[ruby-core:32014] [Ruby 1.9-Bug#3783][Open] Replace Calls to rb_error_frozen() with rb_check_frozen()

From: Run Paint Run Run <redmine@...>
Date: 2010-09-02 12:20:46 UTC
List: ruby-core #32014
Bug #3783: Replace Calls to rb_error_frozen() with rb_check_frozen()
http://redmine.ruby-lang.org/issues/show/3783

Author: Run Paint Run Run
Status: Open, Priority: Low
Category: core
ruby -v: ruby 1.9.3dev (2010-09-02 trunk 29167) [i686-linux] =


This patch replaces lines of the form:
  if (OBJ_FROZEN(obj)) rb_error_frozen("object");
with:
  rb_check_frozen(obj);
This is simpler, and produces error messages that are more consistent and=
 precise.

(It feels wrong cluttering the bug tracker with things like this. Would t=
hey be better posted to the list or sent as a "pull" request?)


----------------------------------------
http://redmine.ruby-lang.org

Attachments (1)

rb_check_frozen.patch (8.34 KB, text/x-diff)
diff --git a/array.c b/array.c
index 4e0585c..53348ef 100644
--- a/array.c
+++ b/array.c
@@ -242,7 +242,7 @@ rb_ary_set_shared(VALUE ary, VALUE shared)
 static inline void
 rb_ary_modify_check(VALUE ary)
 {
-    if (OBJ_FROZEN(ary)) rb_error_frozen("array");
+    rb_check_frozen(ary);
     if (!OBJ_UNTRUSTED(ary) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't modify array");
 }
diff --git a/gc.c b/gc.c
index 9bde487..fb02fe7 100644
--- a/gc.c
+++ b/gc.c
@@ -2674,7 +2674,7 @@ static VALUE
 undefine_final(VALUE os, VALUE obj)
 {
     rb_objspace_t *objspace = &rb_objspace;
-    if (OBJ_FROZEN(obj)) rb_error_frozen("object");
+    rb_check_frozen(obj);
     if (finalizer_table) {
 	st_delete(finalizer_table, (st_data_t*)&obj, 0);
     }
@@ -2698,7 +2698,7 @@ define_final(int argc, VALUE *argv, VALUE os)
     VALUE obj, block, table;
 
     rb_scan_args(argc, argv, "11", &obj, &block);
-    if (OBJ_FROZEN(obj)) rb_error_frozen("object");
+    rb_check_frozen(obj);
     if (argc == 1) {
 	block = rb_block_proc();
     }
diff --git a/hash.c b/hash.c
index 8bba586..1a0e5f8 100644
--- a/hash.c
+++ b/hash.c
@@ -248,7 +248,7 @@ rb_hash_dup(VALUE hash)
 static void
 rb_hash_modify_check(VALUE hash)
 {
-    if (OBJ_FROZEN(hash)) rb_error_frozen("hash");
+    rb_check_frozen(hash);
     if (!OBJ_UNTRUSTED(hash) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
 }
diff --git a/object.c b/object.c
index 34b9529..154338b 100644
--- a/object.c
+++ b/object.c
@@ -712,9 +712,7 @@ rb_obj_taint(VALUE obj)
 {
     rb_secure(4);
     if (!OBJ_TAINTED(obj)) {
-	if (OBJ_FROZEN(obj)) {
-	    rb_error_frozen("object");
-	}
+	rb_check_frozen(obj);
 	OBJ_TAINT(obj);
     }
     return obj;
@@ -733,9 +731,7 @@ rb_obj_untaint(VALUE obj)
 {
     rb_secure(3);
     if (OBJ_TAINTED(obj)) {
-	if (OBJ_FROZEN(obj)) {
-	    rb_error_frozen("object");
-	}
+	rb_check_frozen(obj);
 	FL_UNSET(obj, FL_TAINT);
     }
     return obj;
@@ -768,9 +764,7 @@ rb_obj_untrust(VALUE obj)
 {
     rb_secure(4);
     if (!OBJ_UNTRUSTED(obj)) {
-	if (OBJ_FROZEN(obj)) {
-	    rb_error_frozen("object");
-	}
+	rb_check_frozen(obj);
 	OBJ_UNTRUST(obj);
     }
     return obj;
@@ -789,9 +783,7 @@ rb_obj_trust(VALUE obj)
 {
     rb_secure(3);
     if (OBJ_UNTRUSTED(obj)) {
-	if (OBJ_FROZEN(obj)) {
-	    rb_error_frozen("object");
-	}
+	rb_check_frozen(obj);
 	FL_UNSET(obj, FL_UNTRUSTED);
     }
     return obj;
diff --git a/string.c b/string.c
index f96c770..0dd2389 100644
--- a/string.c
+++ b/string.c
@@ -350,14 +350,6 @@ str_mod_check(VALUE s, const char *p, long len)
     }
 }
 
-static inline void
-str_frozen_check(VALUE s)
-{
-    if (OBJ_FROZEN(s)) {
-	rb_raise(rb_eRuntimeError, "string frozen");
-    }
-}
-
 size_t
 rb_str_capacity(VALUE str)
 {
@@ -1249,7 +1241,7 @@ str_modifiable(VALUE str)
     if (FL_TEST(str, STR_TMPLOCK)) {
 	rb_raise(rb_eRuntimeError, "can't modify string; temporarily locked");
     }
-    if (OBJ_FROZEN(str)) rb_error_frozen("string");
+    rb_check_frozen(str);
     if (!OBJ_UNTRUSTED(str) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't modify string");
 }
@@ -1334,7 +1326,7 @@ void
 rb_str_associate(VALUE str, VALUE add)
 {
     /* sanity check */
-    if (OBJ_FROZEN(str)) rb_error_frozen("string");
+    rb_check_frozen(str);
     if (STR_ASSOC_P(str)) {
 	/* already associated */
 	rb_ary_concat(RSTRING(str)->as.heap.aux.shared, add);
@@ -3549,7 +3541,7 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
                 repl = rb_obj_as_string(repl);
             }
 	    str_mod_check(str, p, len);
-	    str_frozen_check(str);
+	    rb_check_frozen(str);
 	}
 	else {
 	    repl = rb_reg_regsub(repl, str, regs, pat);
diff --git a/struct.c b/struct.c
index f0a377c..78f836f 100644
--- a/struct.c
+++ b/struct.c
@@ -151,7 +151,7 @@ static VALUE (*const ref_func[])(VALUE) = {
 static void
 rb_struct_modify(VALUE s)
 {
-    if (OBJ_FROZEN(s)) rb_error_frozen("Struct");
+    rb_check_frozen(s);
     if (!OBJ_UNTRUSTED(s) && rb_safe_level() >= 4)
        rb_raise(rb_eSecurityError, "Insecure: can't modify Struct");
 }
diff --git a/transcode.c b/transcode.c
index c718182..f5a55e6 100644
--- a/transcode.c
+++ b/transcode.c
@@ -2714,9 +2714,7 @@ str_encode_bang(int argc, VALUE *argv, VALUE str)
     VALUE newstr;
     int encidx;
 
-    if (OBJ_FROZEN(str)) { /* in future, may use str_frozen_check from string.c, but that's currently static */
-	rb_raise(rb_eRuntimeError, "string frozen");
-    }
+    rb_check_frozen(str);
 
     newstr = str;
     encidx = str_transcode(argc, argv, &newstr);
diff --git a/variable.c b/variable.c
index 5333aa2..16ca862 100644
--- a/variable.c
+++ b/variable.c
@@ -1042,7 +1042,7 @@ rb_ivar_set(VALUE obj, ID id, VALUE val)
 
     if (!OBJ_UNTRUSTED(obj) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't modify instance variable");
-    if (OBJ_FROZEN(obj)) rb_error_frozen("object");
+    rb_check_frozen(obj);
     switch (TYPE(obj)) {
       case T_OBJECT:
         iv_index_tbl = ROBJECT_IV_INDEX_TBL(obj);
@@ -1304,7 +1304,7 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name)
 
     if (!OBJ_UNTRUSTED(obj) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't modify instance variable");
-    if (OBJ_FROZEN(obj)) rb_error_frozen("object");
+    rb_check_frozen(obj);
     if (!rb_is_instance_id(id)) {
 	rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id));
     }
@@ -1648,8 +1648,7 @@ rb_const_remove(VALUE mod, ID id)
 
     if (!OBJ_UNTRUSTED(mod) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't remove constant");
-    if (OBJ_FROZEN(mod)) rb_error_frozen("class/module");
-
+    rb_check_frozen(mod);
     if (!RCLASS_IV_TBL(mod) || !st_delete(RCLASS_IV_TBL(mod), &n, &v)) {
 	if (rb_const_defined_at(mod, id)) {
 	    rb_name_error(id, "cannot remove %s::%s",
@@ -1814,14 +1813,7 @@ mod_av_set(VALUE klass, ID id, VALUE val, int isconst)
 
     if (!OBJ_UNTRUSTED(klass) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't set %s", dest);
-    if (OBJ_FROZEN(klass)) {
-	if (BUILTIN_TYPE(klass) == T_MODULE) {
-	    rb_error_frozen("module");
-	}
-	else {
-	    rb_error_frozen("class");
-	}
-    }
+    rb_check_frozen(klass);
     if (!RCLASS_IV_TBL(klass)) {
 	RCLASS_IV_TBL(klass) = st_init_numtable();
     }
@@ -2069,8 +2061,7 @@ rb_mod_remove_cvar(VALUE mod, VALUE name)
     }
     if (!OBJ_UNTRUSTED(mod) && rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't remove class variable");
-    if (OBJ_FROZEN(mod)) rb_error_frozen("class/module");
-
+    rb_check_frozen(mod);
     if (RCLASS_IV_TBL(mod) && st_delete(RCLASS_IV_TBL(mod), &n, &val)) {
 	return (VALUE)val;
     }
diff --git a/vm.c b/vm.c
index 5d249e5..8ecd89c 100644
--- a/vm.c
+++ b/vm.c
@@ -1862,10 +1862,7 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
 		     rb_id2name(id), rb_obj_classname(obj));
 	}
 
-	if (OBJ_FROZEN(obj)) {
-	    rb_error_frozen("object");
-	}
-
+	rb_check_frozen(obj);
 	klass = rb_singleton_class(obj);
 	noex = NOEX_PUBLIC;
     }
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 985a2fb..976147f 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1290,9 +1290,8 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic)
     if (!OBJ_UNTRUSTED(obj) && rb_safe_level() >= 4) {
 	rb_raise(rb_eSecurityError, "Insecure: can't modify instance variable");
     }
-    if (OBJ_FROZEN(obj)) {
-	rb_error_frozen("object");
-    }
+    
+    rb_check_frozen(obj);
 
     if (TYPE(obj) == T_OBJECT) {
 	VALUE klass = RBASIC(obj)->klass;
diff --git a/vm_method.c b/vm_method.c
index 50f0b12..8af529e 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -211,10 +211,8 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
 		rb_class2name(rb_ivar_get(klass, attached)));
 	mid = ID_ALLOCATOR;
     }
-    if (OBJ_FROZEN(klass)) {
-	rb_error_frozen("class/module");
-    }
 
+    rb_check_frozen(klass);
     mtbl = RCLASS_M_TBL(klass);
 
     /* check re-definition */
@@ -463,8 +461,7 @@ remove_method(VALUE klass, ID mid)
     if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(klass)) {
 	rb_raise(rb_eSecurityError, "Insecure: can't remove method");
     }
-    if (OBJ_FROZEN(klass))
-	rb_error_frozen("class/module");
+    rb_check_frozen(klass);
     if (mid == object_id || mid == id__send__ || mid == idInitialize) {
 	rb_warn("removing `%s' may cause serious problems", rb_id2name(mid));
     }

In This Thread

Prev Next