Bug #4438
closed
rescue args type check omitted
Added by nahi (Hiroshi Nakamura) over 13 years ago.
Updated over 12 years ago.
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
Related issues
1 (1 open — 0 closed)
- 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
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
- Target version set to 1.9.3
=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
- Target version changed from 1.9.3 to 2.0.0
Let's discuss spec and impl. before 1.9.4 release.
- 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.
- Related to Feature #19620: allow non-module rescue filters that implement the === opertor added
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0