Bug #4438

rescue args type check omitted

Added by Hiroshi Nakamura over 4 years ago. Updated almost 3 years ago.

[ruby-core:35364]
Status:Closed
Priority:Low
Assignee:Koichi Sasada
ruby -v:- Backport:

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

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

Associated revisions

Revision 36658
Added by Koichi Sasada almost 3 years ago

  • 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.

Revision 36658
Added by Koichi Sasada almost 3 years ago

  • 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.

History

#1 Updated by Yukihiro Matsumoto over 4 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 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

#2 Updated by Yui NARUSE almost 4 years ago

  • Status changed from Open to Assigned
  • Assignee set to Koichi Sasada

#3 Updated by Hiroshi Nakamura almost 4 years ago

  • Target version set to 1.9.3

#4 Updated by Michael Edgar almost 4 years ago

=begin
Right now, the current behavior simply calls (({===})) on whichever handlers are listed; this
results in interesting possibilities (()). 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

#5 Updated by Koichi Sasada almost 4 years ago

  • Target version changed from 1.9.3 to 2.0.0

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

#7 Updated by Koichi Sasada almost 3 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.

Also available in: Atom PDF