Bug #8010

Enumerator#with_index(large_number)

Added by Kazuhiro NISHIYAMA about 1 year ago. Updated 3 months ago.

[ruby-dev:47131]
Status:Closed
Priority:Normal
Assignee:-
Category:core
Target version:-
ruby -v:ruby 2.1.0dev (2013-03-04 trunk 39580) [x86_64-linux] Backport:

Description

Enumerator#with_index の引数で大きな数を指定するとマイナスになったり例外になったりするのはバグでしょうか?

% ruby -ve 'p 3.times.withindex(1<<61).toa'
ruby 2.1.0dev (2013-03-04 trunk 39580) [x8664-linux]
[[0, 2305843009213693952], [1, 2305843009213693953], [2, 2305843009213693954]]
% ruby -ve 'p 3.times.with
index(1<'

Associated revisions

Revision 39594
Added by Nobuyoshi Nakada about 1 year ago

enumerator.c: allow Bignum for with_index

  • enumerator.c (enumeratorwithindex_i): allow Bignum as offset, to get rid of conversion exception and integer overflow. [Bug #8010]

History

#1 Updated by Nobuyoshi Nakada about 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39594.
Kazuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


enumerator.c: allow Bignum for with_index

  • enumerator.c (enumeratorwithindex_i): allow Bignum as offset, to get rid of conversion exception and integer overflow. [Bug #8010]

#2 Updated by Tomoyuki Chikanaga 5 months ago

r39594 and r39596 were backported to ruby20_0 branch at 43960.

#3 Updated by Usaku NAKAMURA 3 months ago

backported into ruby19_3 at r44744.

Also available in: Atom PDF