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

ruby-changes:48614

From: marcandre <ko1@a...>
Date: Fri, 10 Nov 2017 07:05:50 +0900 (JST)
Subject: [ruby-changes:48614] marcandRe: r60728 (trunk): TracePoint.new: raise ArgumentError when no block given [#14074]

marcandre	2017-11-10 07:04:47 +0900 (Fri, 10 Nov 2017)

  New Revision: 60728

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

  Log:
    TracePoint.new: raise ArgumentError when no block given [#14074]

  Modified files:
    trunk/test/ruby/test_settracefunc.rb
    trunk/vm_trace.c
Index: test/ruby/test_settracefunc.rb
===================================================================
--- test/ruby/test_settracefunc.rb	(revision 60727)
+++ test/ruby/test_settracefunc.rb	(revision 60728)
@@ -1770,4 +1770,8 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L1770
       end
     }, bug13705
   end
+
+  def test_trace_point_require_block
+    assert_raise(ArgumentError) { TracePoint.new(:return) }
+  end
 end
Index: vm_trace.c
===================================================================
--- vm_trace.c	(revision 60727)
+++ vm_trace.c	(revision 60728)
@@ -1238,7 +1238,7 @@ rb_tracepoint_new(VALUE target_thval, rb https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1238
  *
  * See TracePoint@Events for possible events and more information.
  *
- * A block must be given, otherwise a ThreadError is raised.
+ * A block must be given, otherwise an ArgumentError is raised.
  *
  * If the trace method isn't included in the given events filter, a
  * RuntimeError is raised.
@@ -1274,7 +1274,7 @@ tracepoint_new_s(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1274
     }
 
     if (!rb_block_given_p()) {
-	rb_raise(rb_eThreadError, "must be called with a block");
+	rb_raise(rb_eArgError, "must be called with a block");
     }
 
     return tracepoint_new(self, 0, events, 0, 0, rb_block_proc());

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

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