Issue #9759 has been updated by Koichi Sasada. Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: UNKNOWN, 2.1: REQUIRED It can be reproduced by the following code: ``` class C9759 define_method(:foo){ raise } end events = [] obj = C9759.new TracePoint.new(:call, :return){|tp| events << [tp.event, tp.method_id] }.enable{ obj.foo rescue nil } p events ``` I hope this fix will be applied to 2.1. ---------------------------------------- Bug #9759: [TracePoint API] return event missing when raising exception https://bugs.ruby-lang.org/issues/9759#change-46404 * Author: David Rodrguez * Status: Closed * Priority: Normal * Assignee: Koichi Sasada * Category: core * Target version: current: 2.2.0 * ruby -v: https://github.com/thoughtbot/factory_girl/blob/master/lib/factory_girl/strategy_syntax_method_registrar.rb * Backport: 2.0.0: UNKNOWN, 2.1: REQUIRED ---------------------------------------- I think I found another bug in the TracePoint API, which seems related to #9321. In this case, the failing event is a return event from a method inside of which the exception was generated. I wrote a failing test case, adapting the code from [factory_girl](https://github.com/thoughtbot/factory_girl/blob/master/lib/factory_girl/strategy_syntax_method_registrar.rb), which is where I first found the strange behaviour. Thanks a lot in advance! ---Files-------------------------------- tracepoint_missing_return_bug.rb (1.37 KB) -- https://bugs.ruby-lang.org/