Actions
Bug #1887
closednil exception can be thrown
Bug #1887:
nil exception can be thrown
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
Backport:
Description
=begin
This code throws nil exception object by assigning nil to $!:
module Any
def self.===(other)
puts "#{self.inspect} === #{other.inspect}"
true
end
end
begin
begin
raise Exception.new
rescue ($!=nil; Exception)
end
puts 'after'
rescue Any
puts "rescue: #{$!.inspect}"
end
The output is:
Any === nil
rescue: nil
Expected behavior:
If $! is set to nil it is not rethrown.
=end
Actions