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

ruby-changes:55495

From: git <ko1@a...>
Date: Tue, 23 Apr 2019 17:49:48 +0900 (JST)
Subject: [ruby-changes:55495] git:159b2bdcb5 (ruby_2_3): * 2019-04-23

git	2019-04-23 10:35:36 +0900 (Tue, 23 Apr 2019)

  New Revision: 159b2bdcb5

  https://git.ruby-lang.org/ruby.git/commit/?id=159b2bdcb5

  Log:
    * 2019-04-23

  Modified files:
    version.h
Index: v1_1r/numeric.c
===================================================================
--- v1_1r/numeric.c	(revision 158)
+++ v1_1r/numeric.c	(revision 159)
@@ -52,6 +52,8 @@ coerce_rescue(x) https://github.com/ruby/ruby/blob/trunk/v1_1r/numeric.c#L52
     VALUE *x;
 {
     TypeError("%s can't be coerced into %s",
+	      rb_special_const_p(x[1])?
+	      STR2CSTR(rb_inspect(x[1])):
 	      rb_class2name(CLASS_OF(x[1])),
 	      rb_class2name(CLASS_OF(x[0])));
 }
@@ -643,6 +645,10 @@ num2int(val) https://github.com/ruby/ruby/blob/trunk/v1_1r/numeric.c#L645
 	TypeError("no implicit conversion from string");
 	return Qnil;		/* not reached */
 
+      case T_NIL:
+	TypeError("no implicit conversion from nil");
+	return Qnil;		/* not reached */
+
       default:
 	val = rb_rescue(to_integer, val, fail_to_integer, val);
 	if (!obj_is_kind_of(val, cInteger)) {
Index: v1_1r/string.c
===================================================================
--- v1_1r/string.c	(revision 158)
+++ v1_1r/string.c	(revision 159)
@@ -429,6 +429,7 @@ str_concat(str1, str2) https://github.com/ruby/ruby/blob/trunk/v1_1r/string.c#L429
 #if 0
     str2 = obj_as_string(str2);
 #else
+    if (NIL_P(str2)) return str1;
     Check_Type(str2, T_STRING);
 #endif
     str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len);
Index: v1_1r/ChangeLog
===================================================================
--- v1_1r/ChangeLog	(revision 158)
+++ v1_1r/ChangeLog	(revision 159)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/v1_1r/ChangeLog#L1
+Wed Apr  8 00:59:13 1998  Yukihiro Matsumoto  <matz@n...>
+
+	* variable.c (rb_const_defined): returned false even if the
+	  constant is defined at the top level.
+
+	* eval.c (f_local_variables): dyna_var->id may be null.  should
+	  have checked before calling str_new2().
+
 Tue Apr  7 18:50:16 1998  Yukihiro Matsumoto  <matz@n...>
 
 	* experimental release 1.1b9_08.
Index: v1_1r/object.c
===================================================================
--- v1_1r/object.c	(revision 158)
+++ v1_1r/object.c	(revision 159)
@@ -289,6 +289,7 @@ nil_plus(x, y) https://github.com/ruby/ruby/blob/trunk/v1_1r/object.c#L289
     VALUE x, y;
 {
     switch (TYPE(y)) {
+      case T_NIL:
       case T_FIXNUM:
       case T_FLOAT:
       case T_BIGNUM:
@@ -297,7 +298,8 @@ nil_plus(x, y) https://github.com/ruby/ruby/blob/trunk/v1_1r/object.c#L298
 	return y;
       default:
 	TypeError("tried to add %s(%s) to nil",
-		  RSTRING(obj_as_string(y))->ptr, rb_class2name(CLASS_OF(y)));
+		  STR2CSTR(rb_inspect(y)),
+		  rb_class2name(CLASS_OF(y)));
     }
     /* not reached */
 }
@@ -722,6 +724,9 @@ f_integer(obj, arg) https://github.com/ruby/ruby/blob/trunk/v1_1r/object.c#L724
       case T_STRING:
 	return str2inum(RSTRING(arg)->ptr, 0);
 
+      case T_NIL:
+	return INT2FIX(0);
+
       default:
 	i = NUM2INT(arg);
     }
Index: v1_1r/variable.c
===================================================================
--- v1_1r/variable.c	(revision 158)
+++ v1_1r/variable.c	(revision 159)
@@ -967,11 +967,16 @@ rb_const_defined(klass, id) https://github.com/ruby/ruby/blob/trunk/v1_1r/variable.c#L967
     VALUE klass;
     ID id;
 {
-    while (klass) {
-	if (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, id, 0)) {
+    VALUE tmp = klass;
+
+    while (tmp) {
+	if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,0)) {
 	    return TRUE;
 	}
-	klass = RCLASS(klass)->super;
+	tmp = RCLASS(tmp)->super;
+    }
+    if (BUILTIN_TYPE(klass) == T_MODULE) {
+	return rb_const_defined(cObject, id);
     }
     if (st_lookup(class_tbl, id, 0))
 	return TRUE;
Index: v1_1r/re.c
===================================================================
--- v1_1r/re.c	(revision 158)
+++ v1_1r/re.c	(revision 159)
@@ -883,7 +883,7 @@ reg_regsub(str, src, regs) https://github.com/ruby/ruby/blob/trunk/v1_1r/re.c#L883
 	char *ss = s;
 
 	c = *s++;
-	if (c != '\\') continue;
+	if (c != '\\' || s == e) continue;
 
 	if (!val) val = str_new(p, ss-p);
 	else      str_cat(val, p, ss-p);
@@ -913,10 +913,6 @@ reg_regsub(str, src, regs) https://github.com/ruby/ruby/blob/trunk/v1_1r/re.c#L913
 	    if (no == 0) continue;
 	    break;
 
-	  case '\\':
-	    str_cat(val, s-1, 1);
-	    continue;
-
 	  default:
 	    str_cat(val, s-2, 2);
 	    continue;
Index: v1_1r/lib/delegate.rb
===================================================================
--- v1_1r/lib/delegate.rb	(revision 158)
+++ v1_1r/lib/delegate.rb	(revision 159)
@@ -47,7 +47,7 @@ class SimpleDelegator<Delegator https://github.com/ruby/ruby/blob/trunk/v1_1r/lib/delegate.rb#L47
   end
 end
 
-# backword compatibility ^_^;;;
+# backward compatibility ^_^;;;
 Delegater = Delegator
 SimpleDelegater = SimpleDelegator
 
Index: v1_1r/eval.c
===================================================================
--- v1_1r/eval.c	(revision 158)
+++ v1_1r/eval.c	(revision 159)
@@ -4462,7 +4462,9 @@ f_local_variables() https://github.com/ruby/ruby/blob/trunk/v1_1r/eval.c#L4462
 
     vars = the_dyna_vars;
     while (vars) {
-	ary_push(ary, str_new2(rb_id2name(vars->id)));
+	if (vars->id) {
+	    ary_push(ary, str_new2(rb_id2name(vars->id)));
+	}
 	vars = vars->next;
     }
 

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

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