Project

General

Profile

Actions

Bug #4438

closed

rescue args type check omitted

Added by nahi (Hiroshi Nakamura) about 13 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:35364]

Description

=begin
Rescue arg must be class or module in 1.8. 1.9 looks to ignore when it's not a class or module.

Is this expected behavior?

0% ruby -ve 'begin; raise; rescue nil; end'
ruby 1.9.3dev (2011-02-23 trunk 30945) [x86_64-linux]
-e:1:in `': unhandled exception
1% ruby187 -ve 'begin; raise; rescue nil; end'
ruby 1.8.7 (2010-12-23 patchlevel 330) [x86_64-linux]
-e:1: class or module required for rescue clause (TypeError)

=end


Files

0001-check-rescue-clause-arguments.patch (6.27 KB) 0001-check-rescue-clause-arguments.patch nobu (Nobuyoshi Nakada), 08/06/2012 10:33 PM

Related issues 1 (1 open0 closed)

Related to Ruby master - Feature #19620: allow non-module rescue filters that implement the === opertorOpenActions

Updated by matz (Yukihiro Matsumoto) about 13 years ago

  • ruby -v changed from ruby 1.9.3dev (2011-02-23 trunk 30945) [x86_64-linux] to -

=begin
Hi,

In message "Re: [ruby-core:35364] [Ruby 1.9 - Bug #4438] [Open] rescue args type check omitted"
on Thu, 24 Feb 2011 19:07:03 +0900, Hiroshi NAKAMURA writes:

|Rescue arg must be class or module in 1.8. 1.9 looks to ignore when it's not a class or module.
|Is this expected behavior?

No, it should check as 1.8 does.

						matz.

=end

Actions #2

Updated by naruse (Yui NARUSE) almost 13 years ago

  • Status changed from Open to Assigned
  • Assignee set to ko1 (Koichi Sasada)

Updated by nahi (Hiroshi Nakamura) almost 13 years ago

  • Target version set to 1.9.3

Updated by adgar (Michael Edgar) almost 13 years ago

=begin
Right now, the current behavior simply calls (({===})) on whichever handlers are listed; this
results in interesting possibilities ((<I briefly explored on my blog|URL:http://carboni.ca/blog/p/Ruby-Did-You-Know-That-2-Exception-Handling>)). I had assumed it was intended. One
could construct interesting possibilities which this behavior: raise an integer, and rescue with
a proc which checks if the integer is nonzero, for example.

Are we sure we don't want this more general behavior? I personally find the flexibility attractive.
=end

Updated by ko1 (Koichi Sasada) almost 13 years ago

  • Target version changed from 1.9.3 to 2.0.0

Let's discuss spec and impl. before 1.9.4 release.

Actions #7

Updated by ko1 (Koichi Sasada) over 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36658.
Hiroshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • compile.c, insns.def (checkmatch):
    remove checkincludearray instruction and
    add new instruction checkmatch.
    This change is to solve
    [Bug #4438] "rescue args type check omitted".
  • iseq.c: increment ISEQ_MAJOR_VERSION because removal of
    checkincludearray instruction.
  • vm_core.h: add several definitions for
    the checkmatch instruction.
  • vm_insnhelper.c (check_match): added.
  • bootstraptest/test_exception.rb: add a test.
  • test/ruby/test_exception.rb: ditto.
Actions #8

Updated by byroot (Jean Boussier) 12 months ago

  • Related to Feature #19620: allow non-module rescue filters that implement the === opertor added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0