Issue #12984 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

This is the expected behavior.  `rescue *array` should mean rescue only exception classes in the array.  It should not mean rescue only exception classes in the array, unless the array is empty, in which case rescue StandardError.  Otherwise you end up changing the meaning of things like:

```ruby
exceptions=[]
exceptions << ArgumentError if ENV["ArgumentError"]
begin
  raise ArgumentError, "x"
rescue *exceptions
  puts "caught"
end
```

----------------------------------------
Bug #12984: `rescue *[]` should be equivalent to `rescue` as `method_call(*[])` is equivalent to `method_call`
https://bugs.ruby-lang.org/issues/12984#change-80037

* Author: bughit (bug hit)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
splatting an empty array to a construct that takes a list is suppose to be equivalent to specifying no list

```ruby
def foo
end

foo *[] #works

```

so `rescue *[]` should be equivalent to `rescue`

```ruby
begin
  raise 'error' #Uncaught exception
rescue *[]
  puts 'caught'
end
```




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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>