$! is not set to nil in an ensure block where no exception is raised --------------------------------------------------------------------
Key: JRUBY-5986 URL: https://jira.codehaus.org/browse/JRUBY-5986 Project: JRuby Issue Type: Bug Affects Versions: JRuby 1.6.3 Environment: jruby 1.6.3 (ruby-1.8.7-p330) (2011-07-07 965162f) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java] Reporter: Lin Jen-Shin Assignee: Thomas E Enebo I am sorry that I cannot reproduce this in a simple way, I'll try to describe it briefly while show you how to reproduce it with full codes. I have a code something like this, I don't want to do something if and only if a SyntaxError exception was raised. I put this in an ensure block, and check against $! def loop_eval input super ensure # SyntaxError might mean we're multiline editing handle_multiline unless $!.kind_of?(SyntaxError) end This works correctly if I am only running the first part of the test, or the last part of the test. BUT if I run all two parts, the last test case would fail, it seems there's no exception was raised, but $! was still pointing to previous SyntaxError exception. If you need to run full code to reproduce this, clone my repository and run with this command: jruby -rubygems -I lib test/more/test_multiline_history.rb Here's the repository: https://github.com/godfat/rib Here's the ensure block: https://github.com/godfat/rib/blob/66d17d7e9935d835cf485e1833ff9efc3374b11b/lib/rib/more/multiline_history.rb#L15-21 Here's the test case: https://github.com/godfat/rib/blob/66d17d7e9935d835cf485e1833ff9efc3374b11b/lib/rib/test/multiline.rb#L115-119 Here's the definition of check: https://github.com/godfat/rib/blob/66d17d7e9935d835cf485e1833ff9efc3374b11b/test/more/test_multiline_history.rb#L9-18 By the first part of the test, I mean a call to: with_history(str) If only with_history(str) is tested, it's fine. If only with_history(str, 'old history') is tested, then it's fine too. But if both of them are running, as it is now, the last check would fail. P.S. Rubinius suffers this even more. MRI 1.8.7 and 1.9.2 works correctly. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email