[前][次][番号順一覧][スレッド一覧]

ruby-changes:31777

From: ko1 <ko1@a...>
Date: Tue, 26 Nov 2013 19:26:50 +0900 (JST)
Subject: [ruby-changes:31777] ko1:r43856 (trunk): * ext/objspace/object_tracing.c (newobj_i): skip class_path if class

ko1	2013-11-26 19:26:41 +0900 (Tue, 26 Nov 2013)

  New Revision: 43856

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43856

  Log:
    * ext/objspace/object_tracing.c (newobj_i): skip class_path if class
      is frozen.
      rb_class_path() can modify frozen classes (and causes errors).
      This patch is temporary. We need no-modification/no-allocation
      class path function.

  Modified files:
    trunk/ChangeLog
    trunk/ext/objspace/object_tracing.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43855)
+++ ChangeLog	(revision 43856)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Nov 26 19:17:47 2013  Koichi Sasada  <ko1@a...>
+
+	* ext/objspace/object_tracing.c (newobj_i): skip class_path if class
+	  is frozen.
+
+	  rb_class_path() can modify frozen classes (and causes errors).
+	  This patch is temporary. We need no-modification/no-allocation
+	  class path function.
+
 Tue Nov 26 18:12:13 2013  Koichi Sasada  <ko1@a...>
 
 	* vm_trace.c: skip "exception check" and "reentrant check (only normal
Index: ext/objspace/object_tracing.c
===================================================================
--- ext/objspace/object_tracing.c	(revision 43855)
+++ ext/objspace/object_tracing.c	(revision 43856)
@@ -81,7 +81,7 @@ newobj_i(VALUE tpval, void *data) https://github.com/ruby/ruby/blob/trunk/ext/objspace/object_tracing.c#L81
     VALUE klass = rb_tracearg_defined_class(tparg);
     struct allocation_info *info;
     const char *path_cstr = RTEST(path) ? make_unique_str(arg->str_table, RSTRING_PTR(path), RSTRING_LEN(path)) : 0;
-    VALUE class_path = RTEST(klass) ? rb_class_path(klass) : Qnil;
+    VALUE class_path = (RTEST(klass) && !OBJ_FROZEN(klass)) ? rb_class_path(klass) : Qnil;
     const char *class_path_cstr = RTEST(class_path) ? make_unique_str(arg->str_table, RSTRING_PTR(class_path), RSTRING_LEN(class_path)) : 0;
 
     if (st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]