Project

General

Profile

Bug #15455

In v2.6.0 the return value of `each_with_object` and `each_object` is truncated when the object is a hash.

Added by CaryInVictoria (Cary Swoveland) 9 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:90685]

Description

RUBY VERSION: 2.6.0 (2018-12-23 patchlevel -1)

a = [1, 2, 3]

a.each_with_object([]) #=> #<Enumerator: [1, 2, 3]:each_with_object([])>
a.each_with_object(1..3) #=> #<Enumerator: [1, 2, 3]:each_with_object(1..3)>
a.each_with_object("cat") #=> #<Enumerator: [1, 2, 3]:each_with_object("cat")>

So far so good. But there is a problem when the object is a hash.

a.each_with_object({}) #=> #<Enumerator: [1, 2, 3]:each_with_objec)>
a.each_with_object(Hash.new(0)) #=> #<Enumerator: [1, 2, 3]:each_with_objec)>
a.each.with_object(Hash.new(0)) #=> #<Enumerator: #<Enumerator: [1, 2, 3]:each>:with_objec)>

This problem does not occur with v2.5.3.

Associated revisions

Revision 483c7290
Added by nobu (Nobuyoshi Nakada) 9 months ago

enumerator.c: fix inspect with the last empty hash

[ruby-core:90685] [Bug #15455]

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

Revision 66519
Added by nobu (Nobuyoshi Nakada) 9 months ago

enumerator.c: fix inspect with the last empty hash

[ruby-core:90685] [Bug #15455]

Revision 66519
Added by nobu (Nobuyoshi Nakada) 9 months ago

enumerator.c: fix inspect with the last empty hash

[ruby-core:90685] [Bug #15455]

History

Updated by shevegen (Robert A. Heiler) 9 months ago

X-mas day change doable? :)

Updated by CaryInVictoria (Cary Swoveland) 9 months ago

  • Description updated (diff)

Corrected a tiny typo.

#3

Updated by nobu (Nobuyoshi Nakada) 9 months ago

  • Status changed from Open to Closed

Applied in changeset trunk|r66519.


enumerator.c: fix inspect with the last empty hash

[ruby-core:90685] [Bug #15455]

Also available in: Atom PDF