Issue Type: Bug Bug
Affects Versions: JRuby 1.6.7
Assignee: Unassigned
Components: Interpreter
Created: 15/Aug/12 10:28 AM
Description:

What steps will reproduce the problem?

jruby 1.6.7.2 (ruby-1.8.7-p357) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_33) [darwin-x86_64-java]
$ ruby -e "test = {'t' => 3}; test.each { test['e'] = 2 }"
RuntimeError: can't add a new key into hash during iteration
[]= at org/jruby/RubyHash.java:899
_file_ at -e:1
each at org/jruby/RubyHash.java:1181
(root) at -e:1

What is the expected output? What do you see instead?
I would expect the command to pass without failure

Additional information
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-darwin11.3.0]
$ ruby -e "test = {'t' => 3}; test.each { test['e'] = 2 }"
-e:1:in `[]=': can't add a new key into hash during iteration (RuntimeError)
from -e:1:in `block in <main>'
from -e:1:in `each'
from -e:1:in `<main>'

ruby 1.8.7 (2012-06-29 patchlevel 370) [i686-darwin11.4.0]
$ ruby -e "test = {'t' => 3}; test.each { test['e'] = 2 }" //no error

jruby 1.6.7.2 (ruby-1.9.2-p312) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_33) [darwin-x86_64-java]
$ ruby -e "test = {'t' => 3}; test.each { test['e'] = 2 }"
RuntimeError: can't add a new key into hash during iteration
[]= at org/jruby/RubyHash.java:907
_file_ at -e:1
each at org/jruby/RubyHash.java:1186
(root) at -e:1

Environment: Mac OS X 10.7.3

$ uname -a
Darwin lon032maclocal.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64



Project: JRuby
Priority: Minor Minor
Reporter: Richard Nienaber
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
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

Reply via email to