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

ruby-changes:44366

From: nagachika <ko1@a...>
Date: Tue, 18 Oct 2016 02:55:44 +0900 (JST)
Subject: [ruby-changes:44366] nagachika:r56439 (ruby_2_3): merge revision(s) 56363, 56365: [Backport #12811]

nagachika	2016-10-18 02:55:39 +0900 (Tue, 18 Oct 2016)

  New Revision: 56439

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

  Log:
    merge revision(s) 56363,56365: [Backport #12811]
    
    * load.c (rb_require_safe): SyntaxError created by the parser just
      has the mesage and needs to set up the backtrace.
      [ruby-core:77491] [Bug #12811]
      has the message and needs to set up the backtrace.

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/load.c
    branches/ruby_2_3/test/ruby/test_require.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/load.c
===================================================================
--- ruby_2_3/load.c	(revision 56438)
+++ ruby_2_3/load.c	(revision 56439)
@@ -1043,6 +1043,7 @@ rb_require_safe(VALUE fname, int safe) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/load.c#L1043
     int result = rb_require_internal(fname, safe);
 
     if (result > TAG_RETURN) {
+	if (result == TAG_RAISE) rb_exc_raise(rb_errinfo());
 	JUMP_TAG(result);
     }
     if (result < 0) {
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 56438)
+++ ruby_2_3/version.h	(revision 56439)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.2"
 #define RUBY_RELEASE_DATE "2016-10-18"
-#define RUBY_PATCHLEVEL 197
+#define RUBY_PATCHLEVEL 198
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 10
Index: ruby_2_3/test/ruby/test_require.rb
===================================================================
--- ruby_2_3/test/ruby/test_require.rb	(revision 56438)
+++ ruby_2_3/test/ruby/test_require.rb	(revision 56439)
@@ -182,6 +182,26 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_require.rb#L182
     end
   end
 
+  def assert_syntax_error_backtrace
+    Dir.mktmpdir do |tmp|
+      req = File.join(tmp, "test.rb")
+      File.write(req, "'\n")
+      e = assert_raise_with_message(SyntaxError, /unterminated/) {
+        yield req
+      }
+      assert_not_nil(bt = e.backtrace)
+      assert_not_empty(bt.find_all {|b| b.start_with? __FILE__})
+    end
+  end
+
+  def test_require_syntax_error
+    assert_syntax_error_backtrace {|req| require req}
+  end
+
+  def test_load_syntax_error
+    assert_syntax_error_backtrace {|req| load req}
+  end
+
   def test_define_class
     begin
       require "socket"

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r56363,56365


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

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