Actions
Bug #17305
closedrb_rescue2() seems to loop forever if given a non-module for rescued exceptions on <= 2.6.6
    Bug #17305:
    rb_rescue2() seems to loop forever if given a non-module for rescued exceptions on <= 2.6.6
  
Description
Specifically,
      it "raises TypeError if one of the passed exceptions is not a Module" do
        -> {
          @s.rb_rescue2(-> *_ { raise RuntimeError, "foo" }, :no_exc, -> x { x }, :exc, Object.new, 42)
        }.should raise_error(TypeError, /class or module required/)
      end
in
spec/ruby/optional/capi/kernel_spec.rb
reproduces the issue.
Ruby 2.7.0+ seems fine and raises the expected TypeError.
Files
        
           Updated by Eregon (Benoit Daloze) almost 5 years ago
          Updated by Eregon (Benoit Daloze) almost 5 years ago
          
          
        
        
      
      - Description updated (diff)
        
           Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago
          Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago
          
          
        
        
      
      - File 0001-Fix-rb_rescue2-when-called-with-non-module.patch 0001-Fix-rb_rescue2-when-called-with-non-module.patch added
- Status changed from Open to Closed
- Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: DONTNEED, 2.6: REQUIRED, 2.7: DONTNEED
I bisected the fix to a569bc09e25a2ba813d0bec1228d9ff65330a3db. We definitely don't want the entire commit. Attached is a minimal subset of the commit that doesn't introduce a new external function, in case @nagachika (Tomoyuki Chikanaga) would like to backport it. Closing now that a fix has been identified and the issue doesn't exist in master.
        
           Updated by vo.x (Vit Ondruch) almost 5 years ago
          Updated by vo.x (Vit Ondruch) almost 5 years ago
          
          
        
        
      
      - Related to Bug #17338: ruby-spec stuck in "C-API Kernel function rb_rescue2" added
        
           Updated by Eregon (Benoit Daloze) almost 5 years ago
          Updated by Eregon (Benoit Daloze) almost 5 years ago
          
          
        
        
      
      This bug seems to happen on master too, for some platforms, see #17338.
        
           Updated by usa (Usaku NAKAMURA) over 4 years ago
          Updated by usa (Usaku NAKAMURA) over 4 years ago
          
          
        
        
      
      - Backport changed from 2.5: DONTNEED, 2.6: REQUIRED, 2.7: DONTNEED to 2.5: DONTNEED, 2.6: DONE, 2.7: DONTNEED
merged the patch into ruby_2_6 at r67922
Actions