Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$! gets unset by rescue, even when the rescue doesn't catch the error #3237

Closed
iconara opened this Issue Aug 8, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@iconara
Copy link
Contributor

iconara commented Aug 8, 2015

This code will print "#<RuntimeError: bork>" in JRuby 1.7.x as well as all MRI versions I tested, but "nil" in JRuby 9.0.0.0:

begin
  begin
    raise 'bork'
  rescue TypeError
  end
ensure
  p $!
end

Removing the inner begin … rescue makes it print "#<RuntimeError: bork>" again. It looks like rescue clears $!. The error matched by the inner rescue doesn't matter, and catching the error and re-raising it also leaves $! unset.

iconara added a commit to iconara/ione that referenced this issue Aug 8, 2015

iconara added a commit to iconara/ione that referenced this issue Aug 8, 2015

@enebo enebo added this to the JRuby 9.0.1.0 milestone Aug 18, 2015

@subbuss subbuss closed this in 80f6a36 Aug 19, 2015

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Aug 19, 2015

Perly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.