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

KeyError message renders String keys as Symbols #4729

olleolleolle opened this Issue Jul 31, 2017 · 0 comments


None yet
2 participants

olleolleolle commented Jul 31, 2017


➜  ~ ruby -v
jruby (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [darwin-x86_64]
➜  ~ uname -a
Darwin Olles-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Tue Apr 11 16:00:51 PDT 2017; root:xnu-3248. x86_64

Expected Behavior

2.4.0 :001 > { }.fetch("THE_MOPEDS")
KeyError: key not found: "THE_MOPEDS"
	from (irb):1:in `fetch'
	from (irb):1
	from /Users/olle/.rvm/rubies/ruby-2.4.0/bin/irb:11:in `<main>'

Actual Behavior

jruby- :012 > { }.fetch("THE_MOPEDS")
KeyError: key not found: :THE_MOPEDS
	from org/jruby/ `fetch'
	from (irb):12:in `<eval>'
	from org/jruby/ `eval'
	from org/jruby/ `loop'
	from org/jruby/ `catch'
	from org/jruby/ `catch'
	from /Users/olle/.rvm/rubies/jruby- `<main>'

rawrasaur added a commit to rawrasaur/jruby that referenced this issue Jul 31, 2017

Fix error message in Hash#fetch
In Hash#fetch, the old error message assumed the key was a symbol. Instead we
inspect it like in MRI. This closes jruby#4729.

@kares kares added this to the JRuby milestone Aug 4, 2017

@headius headius closed this in #4730 Aug 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment