Bug #4438
closedrescue args type check omitted
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
Updated by matz (Yukihiro Matsumoto) over 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 nakahiro@gmail.com 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
Updated by naruse (Yui NARUSE) over 13 years ago
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
Updated by nahi (Hiroshi Nakamura) over 13 years ago
- Target version set to 1.9.3
Updated by adgar (Michael Edgar) over 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) over 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.
Updated by nobu (Nobuyoshi Nakada) over 12 years ago
Patch attached.
Updated by ko1 (Koichi Sasada) over 12 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.
Updated by byroot (Jean Boussier) over 1 year ago
- Related to Feature #19620: allow non-module rescue filters that implement the === opertor added