Project

General

Profile

Bug #14247

Thread#fetch raise KeyError without key and receiver

Added by znz (Kazuhiro NISHIYAMA) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.6.0dev (2017-12-27 trunk 61494) [x86_64-linux]
[ruby-core:84508]

Description

I found this by message without Did you mean?.

expected:

% ruby -e 'th=Thread.current;th[:foo]=1;th.fetch(:fooo)'
Traceback (most recent call last):
        1: from -e:1:in `<main>'
-e:1:in `fetch': key not found: "fooo" (KeyError)
Did you mean?  :foo

actual:

% ruby -e 'th=Thread.current;th[:foo]=1;th.fetch(:fooo)'
Traceback (most recent call last):
        1: from -e:1:in `<main>'
-e:1:in `fetch': key not found: fooo (KeyError)

Files

Thread-KeyError.diff (870 Bytes) Thread-KeyError.diff znz (Kazuhiro NISHIYAMA), 12/27/2017 12:05 PM
0001-Fix-KeyError-key-receiver-of-Thread-fetch.patch (1.22 KB) 0001-Fix-KeyError-key-receiver-of-Thread-fetch.patch znz (Kazuhiro NISHIYAMA), 12/27/2017 01:54 PM

Associated revisions

Revision 220d2a71
Added by kazu almost 2 years ago

Fix KeyError#{key,receiver} of Thread#fetch

[ruby-core:84508] [Bug #14247]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 61507
Added by znz (Kazuhiro NISHIYAMA) almost 2 years ago

Fix KeyError#{key,receiver} of Thread#fetch

[ruby-core:84508] [Bug #14247]

Revision 61507
Added by kazu almost 2 years ago

Fix KeyError#{key,receiver} of Thread#fetch

[ruby-core:84508] [Bug #14247]

Revision ba5b7136
Added by naruse (Yui NARUSE) almost 2 years ago

merge revision(s) 61507: [Backport #14247]

    Fix KeyError#{key,receiver} of Thread#fetch

    [ruby-core:84508] [Bug #14247]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@61583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 61583
Added by naruse (Yui NARUSE) almost 2 years ago

merge revision(s) 61507: [Backport #14247]

Fix KeyError#{key,receiver} of Thread#fetch

[ruby-core:84508] [Bug #14247]

History

Updated by nobu (Nobuyoshi Nakada) almost 2 years ago

The given key is :fooo symbol, so the message should be :fooo but not "fooo".
Use "%+"PRIsVALUE instead of "\"%"PRIsVALUE"\"" for inspection.

Updated by znz (Kazuhiro NISHIYAMA) almost 2 years ago

Update patch.

% ruby -e 'th=Thread.current;th[:foo]=1;th.fetch(:fooo)'
Traceback (most recent call last):
        1: from -e:1:in `<main>'
-e:1:in `fetch': key not found: :fooo (KeyError)
Did you mean?  :foo
% ruby -e 'th=Thread.current;th[:foo]=1;th.fetch("fooo")'
Traceback (most recent call last):
        1: from -e:1:in `<main>'
-e:1:in `fetch': key not found: "fooo" (KeyError)
Did you mean?  :foo

Updated by shevegen (Robert A. Heiler) almost 2 years ago

Indeed. I actually had to look twice to see the error. :)

#4

Updated by Anonymous almost 2 years ago

  • Status changed from Assigned to Closed

Applied in changeset trunk|r61507.


Fix KeyError#{key,receiver} of Thread#fetch

[ruby-core:84508] [Bug #14247]

#5

Updated by nagachika (Tomoyuki Chikanaga) almost 2 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED

Updated by naruse (Yui NARUSE) almost 2 years ago

  • Backport changed from 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONE

ruby_2_5 r61583 merged revision(s) 61507.

Also available in: Atom PDF