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

ruby-changes:50657

From: usa <ko1@a...>
Date: Mon, 19 Mar 2018 00:04:56 +0900 (JST)
Subject: [ruby-changes:50657] usa:r62820 (ruby_2_3): merge revision(s) 55372: [Backport #14179]

usa	2018-03-19 00:04:49 +0900 (Mon, 19 Mar 2018)

  New Revision: 62820

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62820

  Log:
    merge revision(s) 55372: [Backport #14179]
    * lib/forwardable.rb (_delegator_method): leave the backtrace
      untouched during accessor.  forwardable.rb does not appear in
      the backtrace during delegated method because of tail-call
      optimization.

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/lib/forwardable.rb
    branches/ruby_2_3/test/test_forwardable.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/test/test_forwardable.rb
===================================================================
--- ruby_2_3/test/test_forwardable.rb	(revision 62819)
+++ ruby_2_3/test/test_forwardable.rb	(revision 62820)
@@ -225,18 +225,21 @@ class TestForwardable < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/test_forwardable.rb#L225
   class Foo
     extend Forwardable
 
+    attr_accessor :bar
     def_delegator :bar, :baz
     def_delegator :caller, :itself, :c
-
-    class Exception
-    end
   end
 
   def test_backtrace_adjustment
+    obj = Foo.new
+    def (obj.bar = Object.new).baz
+      foo
+    end
     e = assert_raise(NameError) {
-      Foo.new.baz
+      obj.baz
     }
-    assert_not_match(/\/forwardable\.rb/, e.backtrace[0])
+    assert_not_match(/\/forwardable\.rb/, e.backtrace[0],
+                     proc {RubyVM::InstructionSequence.of(obj.method(:baz)).disassemble})
     assert_equal(caller(0, 1)[0], Foo.new.c[0])
   end
 
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 62819)
+++ ruby_2_3/version.h	(revision 62820)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.7"
 #define RUBY_RELEASE_DATE "2018-03-19"
-#define RUBY_PATCHLEVEL 420
+#define RUBY_PATCHLEVEL 421
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/lib/forwardable.rb
===================================================================
--- ruby_2_3/lib/forwardable.rb	(revision 62819)
+++ ruby_2_3/lib/forwardable.rb	(revision 62820)
@@ -113,12 +113,9 @@ module Forwardable https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/forwardable.rb#L113
   # Version of +forwardable.rb+
   FORWARDABLE_VERSION = "1.1.0"
 
-  FILE_REGEXP = %r"#{Regexp.quote(__FILE__)}"
-
   @debug = nil
   class << self
-    # If true, <tt>__FILE__</tt> will remain in the backtrace in the event an
-    # Exception is raised.
+    # ignored
     attr_accessor :debug
   end
 
@@ -203,8 +200,6 @@ module Forwardable https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/forwardable.rb#L200
         def #{ali}(*args, &block)
           begin
             #{accessor}
-          ensure
-            $@.delete_if {|s| ::Forwardable::FILE_REGEXP =~ s} if $@ and !::Forwardable::debug
           end.__send__ :#{method}, *args, &block
         end
       end
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 62819)
+++ ruby_2_3/ChangeLog	(revision 62820)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Mon Mar 19 00:04:08 2018  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/forwardable.rb (_delegator_method): leave the backtrace
+	  untouched during accessor.  forwardable.rb does not appear in
+	  the backtrace during delegated method because of tail-call
+	  optimization.
+
 Sun Mar 18 23:59:32 2018  Nobuyoshi Nakada  <nobu@r...>
 
 	dup String#partition return value
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 62819)
+++ ruby_2_3	(revision 62820)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r55372

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

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