Project

General

Profile

Actions

Bug #9335

closed

dynamic rescue regression in Ruby 2.1

Added by fdr (Daniel Farina) almost 11 years ago. Updated almost 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
[ruby-core:59445]

Description

The following type of rescue block appears broken:

begin
raise 'hello'
rescue ->(e) { true }
end

In Ruby 1.9.3p484, this exits with a normal exit code and no output.

On Ruby 2.1.0, it instead yields:

/tmp/badin21.rb:4:in rescue in <main>': class or module required for rescue clause (TypeError) from /tmp/badin21.rb:2:in '

Some research suggests this is a regression to the pre-1.9.2 behavior, and there doesn't seem to be any direct mention about this change in the changelog of 2.1 nor 2.0.


Files

badin21.rb (64 Bytes) badin21.rb test case fdr (Daniel Farina), 01/01/2014 11:21 AM

Updated by fdr (Daniel Farina) almost 11 years ago

This seems to apply to 2.0 as well. Here's the commit found by git bisect:

commit 93b6f8d6195564d0884ee00f536a951f4c26288c
Author: ko1
Date: Wed Aug 8 07:52:19 2012 +0000

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



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Updated by fdr (Daniel Farina) almost 11 years ago

Some other person on the internet also took the time to track this change in behaviors over time:

https://gist.github.com/gmallard/7034128

Updated by nobu (Nobuyoshi Nakada) almost 11 years ago

  • Status changed from Open to Rejected

It had been allowed on 1.9.3 accidentally.
In other words, it's a fixed bug.

Updated by avdi (Avdi Grimm) almost 11 years ago

I believe I can make a solid case for this as an accidental feature rather
than a bug. Should I open a new ticket to do so?

On Wed, Jan 1, 2014 at 1:28 AM, nobu (Nobuyoshi Nakada)
wrote:

Issue #9335 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Rejected

It had been allowed on 1.9.3 accidentally.
In other words, it's a fixed bug.


Bug #9335: dynamic rescue regression in Ruby 2.1
https://bugs.ruby-lang.org/issues/9335#change-44005

Author: fdr (Daniel Farina)
Status: Rejected
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN

The following type of rescue block appears broken:

begin
raise 'hello'
rescue ->(e) { true }
end

In Ruby 1.9.3p484, this exits with a normal exit code and no output.

On Ruby 2.1.0, it instead yields:

/tmp/badin21.rb:4:in rescue in <main>': class or module required for rescue clause (TypeError) from /tmp/badin21.rb:2:in '

Some research suggests this is a regression to the pre-1.9.2 behavior, and
there doesn't seem to be any direct mention about this change in the
changelog of 2.1 nor 2.0.

--
http://bugs.ruby-lang.org/

--
Avdi Grimm
http://avdi.org

I only check email twice a day. to reach me sooner, go to
http://awayfind.com/avdi

Updated by drbrain (Eric Hodel) almost 11 years ago

On 1 Jan 2014, at 13:19, Avdi Grimm wrote:

I believe I can make a solid case for this as an accidental feature rather than a bug. Should I open a new ticket to do so?

I think so.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0