<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_enumerator.rb, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) b176d4f52e4af67654814dab3e9c5f4bf9170e54: [Backport #21008]</title>
<updated>2025-01-15T02:00:02+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-01-15T02:00:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7b9caf19ba480d168ef4c5e93690735240975c91'/>
<id>7b9caf19ba480d168ef4c5e93690735240975c91</id>
<content type='text'>
	[Bug #21008] Normalize before sum to float

	After switching to `Float`-mode when summing `Numeric` objects,
	normalization for `Float` is still needed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #21008] Normalize before sum to float

	After switching to `Float`-mode when summing `Numeric` objects,
	normalization for `Float` is still needed.
</pre>
</div>
</content>
</entry>
<entry>
<title>Skip under_gc_compact_stress on s390x (#10073)</title>
<updated>2024-05-29T18:13:02+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-02-22T22:34:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2f4fe76eff0a8c6ab7a1d2fb845453acfc3cb206'/>
<id>2f4fe76eff0a8c6ab7a1d2fb845453acfc3cb206</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix off-by-one error for declarative marking</title>
<updated>2023-12-25T01:37:59+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-12-24T21:23:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=70618a48f7f9f12943e963bf121b56af4153f394'/>
<id>70618a48f7f9f12943e963bf121b56af4153f394</id>
<content type='text'>
The for loops for marking and reference updating declaratively marked
TypedData objects did not mark/reference update the very last element.

When RGENGC_CHECK_MODE is turned on, this caused the test in Enumerator
to fail with:

    tool/lib/test/unit/testcase.rb:173:in `rescue in run': failed to allocate memory (NoMemoryError)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The for loops for marking and reference updating declaratively marked
TypedData objects did not mark/reference update the very last element.

When RGENGC_CHECK_MODE is turned on, this caused the test in Enumerator
to fail with:

    tool/lib/test/unit/testcase.rb:173:in `rescue in run': failed to allocate memory (NoMemoryError)
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix Enumerator#with_index for GC compaction</title>
<updated>2023-12-24T21:22:34+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-12-24T17:10:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5af64ff7db3d636201db68b9ba995131a04a8f7b'/>
<id>5af64ff7db3d636201db68b9ba995131a04a8f7b</id>
<content type='text'>
enumerator_block_call was not safe for compaction because the Array
backing the argv was not pinned, so it could get moved during compaction
which would make argv point to somewhere else.

The test crashes when RGENGC_CHECK_MODE is turned on:

    TestEnumerator#test_with_index_under_gc_compact_stress
    check_rvalue_consistency: 0x55db0b399450 is not a Ruby object.
    test/ruby/test_enumerator.rb:133: [BUG] check_rvalue_consistency_force: there is 1 errors.
    ruby 3.3.0dev (2023-12-23T23:00:27Z master 50bf437341) [x86_64-linux]
    -- Control frame information -----------------------------------------------
    c:0034 p:---- s:0192 e:000187 CFUNC  :with_index
    c:0033 p:---- s:0185 e:000184 CFUNC  :each
    c:0032 p:---- s:0182 e:000181 CFUNC  :to_a
    c:0031 p:0055 s:0178 e:000175 BLOCK  test/ruby/test_enumerator.rb:133
    c:0030 p:0024 s:0172 e:000171 METHOD tool/lib/envutil.rb:242
    c:0029 p:0024 s:0167 e:000166 METHOD tool/lib/envutil.rb:251
    c:0028 p:0005 s:0160 e:000159 METHOD test/ruby/test_enumerator.rb:131
    ...
    -- C level backtrace information -------------------------------------------
    build/ruby(rb_print_backtrace+0x14) [0x55db0b1deb21] vm_dump.c:820
    build/ruby(rb_vm_bugreport) vm_dump.c:1151
    build/ruby(bug_report_end+0x0) [0x55db0b3a53a6] error.c:1042
    build/ruby(rb_bug_without_die) error.c:1042
    build/ruby(die+0x0) [0x55db0afc77c2] error.c:1050
    build/ruby(rb_bug) error.c:1052
    build/ruby(gc_move+0x0) [0x55db0afbada0] gc.c:1714
    build/ruby(check_rvalue_consistency+0xa) [0x55db0afef0c3] gc.c:1729
    build/ruby(is_markable_object) gc.c:4769
    build/ruby(gc_mark_stack_values) gc.c:6595
    build/ruby(rb_gc_mark_vm_stack_values) gc.c:6605
    build/ruby(rb_execution_context_mark+0x39) [0x55db0b1d8589] vm.c:3309
    build/ruby(thread_mark+0x15) [0x55db0b1a9805] vm.c:3381
    build/ruby(gc_mark_stacked_objects+0x6d) [0x55db0aff2c3d] gc.c:7564
    build/ruby(gc_mark_stacked_objects_all) gc.c:7602
    build/ruby(gc_marks_rest) gc.c:8797
    build/ruby(gc_marks+0xd) [0x55db0aff43d5] gc.c:8855
    build/ruby(gc_start) gc.c:9608
    build/ruby(rb_multi_ractor_p+0x0) [0x55db0aff5463] gc.c:9489
    build/ruby(rb_vm_lock_leave) vm_sync.h:92
    build/ruby(garbage_collect) gc.c:9491
    build/ruby(newobj_slowpath+0xcb) [0x55db0aff57ab] gc.c:2871
    build/ruby(newobj_slowpath_wb_protected) gc.c:2895
    build/ruby(newobj_of0+0x24) [0x55db0aff59e4] gc.c:2937
    build/ruby(newobj_of) gc.c:2947
    build/ruby(rb_wb_protected_newobj_of) gc.c:2962
    build/ruby(ary_alloc_embed+0x10) [0x55db0b2f3e40] array.c:668
    build/ruby(ary_new) array.c:709
    build/ruby(rb_ary_tmp_new_from_values) array.c:759
    build/ruby(rb_ary_new_from_values) array.c:771
    build/ruby(args_copy+0x18) [0x55db0b1bbb88] vm_args.c:158
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
enumerator_block_call was not safe for compaction because the Array
backing the argv was not pinned, so it could get moved during compaction
which would make argv point to somewhere else.

The test crashes when RGENGC_CHECK_MODE is turned on:

    TestEnumerator#test_with_index_under_gc_compact_stress
    check_rvalue_consistency: 0x55db0b399450 is not a Ruby object.
    test/ruby/test_enumerator.rb:133: [BUG] check_rvalue_consistency_force: there is 1 errors.
    ruby 3.3.0dev (2023-12-23T23:00:27Z master 50bf437341) [x86_64-linux]
    -- Control frame information -----------------------------------------------
    c:0034 p:---- s:0192 e:000187 CFUNC  :with_index
    c:0033 p:---- s:0185 e:000184 CFUNC  :each
    c:0032 p:---- s:0182 e:000181 CFUNC  :to_a
    c:0031 p:0055 s:0178 e:000175 BLOCK  test/ruby/test_enumerator.rb:133
    c:0030 p:0024 s:0172 e:000171 METHOD tool/lib/envutil.rb:242
    c:0029 p:0024 s:0167 e:000166 METHOD tool/lib/envutil.rb:251
    c:0028 p:0005 s:0160 e:000159 METHOD test/ruby/test_enumerator.rb:131
    ...
    -- C level backtrace information -------------------------------------------
    build/ruby(rb_print_backtrace+0x14) [0x55db0b1deb21] vm_dump.c:820
    build/ruby(rb_vm_bugreport) vm_dump.c:1151
    build/ruby(bug_report_end+0x0) [0x55db0b3a53a6] error.c:1042
    build/ruby(rb_bug_without_die) error.c:1042
    build/ruby(die+0x0) [0x55db0afc77c2] error.c:1050
    build/ruby(rb_bug) error.c:1052
    build/ruby(gc_move+0x0) [0x55db0afbada0] gc.c:1714
    build/ruby(check_rvalue_consistency+0xa) [0x55db0afef0c3] gc.c:1729
    build/ruby(is_markable_object) gc.c:4769
    build/ruby(gc_mark_stack_values) gc.c:6595
    build/ruby(rb_gc_mark_vm_stack_values) gc.c:6605
    build/ruby(rb_execution_context_mark+0x39) [0x55db0b1d8589] vm.c:3309
    build/ruby(thread_mark+0x15) [0x55db0b1a9805] vm.c:3381
    build/ruby(gc_mark_stacked_objects+0x6d) [0x55db0aff2c3d] gc.c:7564
    build/ruby(gc_mark_stacked_objects_all) gc.c:7602
    build/ruby(gc_marks_rest) gc.c:8797
    build/ruby(gc_marks+0xd) [0x55db0aff43d5] gc.c:8855
    build/ruby(gc_start) gc.c:9608
    build/ruby(rb_multi_ractor_p+0x0) [0x55db0aff5463] gc.c:9489
    build/ruby(rb_vm_lock_leave) vm_sync.h:92
    build/ruby(garbage_collect) gc.c:9491
    build/ruby(newobj_slowpath+0xcb) [0x55db0aff57ab] gc.c:2871
    build/ruby(newobj_slowpath_wb_protected) gc.c:2895
    build/ruby(newobj_of0+0x24) [0x55db0aff59e4] gc.c:2937
    build/ruby(newobj_of) gc.c:2947
    build/ruby(rb_wb_protected_newobj_of) gc.c:2962
    build/ruby(ary_alloc_embed+0x10) [0x55db0b2f3e40] array.c:668
    build/ruby(ary_new) array.c:709
    build/ruby(rb_ary_tmp_new_from_values) array.c:759
    build/ruby(rb_ary_new_from_values) array.c:771
    build/ruby(args_copy+0x18) [0x55db0b1bbb88] vm_args.c:158
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix [Bug #19632]: Disable external iterator for frozen enumerator (#7791)</title>
<updated>2023-10-25T07:32:25+00:00</updated>
<author>
<name>Hiroya Fujinami</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2023-10-25T07:32:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3e64cf60b5162bb5dad772f300b7f6346e5f83f9'/>
<id>3e64cf60b5162bb5dad772f300b7f6346e5f83f9</id>
<content type='text'>
* Fix [Bug #19632]: Disable external iterator for frozen enumerator

Currently, methods to manipulate an external iterator like `#next`
and `#feed` can be called even if a receiver of an enumerator is
frozen. However, these methods change the state of an external
iterator in an enumerator. Therefore, it seems a BUG to me, and
these methods should raise FrozenError if the receiver is frozen.

This fixed the following methods to raise FrozenError if the receiver is
frozen.

- `Enumerator#next`
- `Enumerator#next_values`
- `Enumerator#peek`
- `Enumerator#peek_values`
- `Enumerator#feed`
- `Enumerator#rewind`

* Fix a typo in the document

Thanks @Maumagnaguagno.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Fix [Bug #19632]: Disable external iterator for frozen enumerator

Currently, methods to manipulate an external iterator like `#next`
and `#feed` can be called even if a receiver of an enumerator is
frozen. However, these methods change the state of an external
iterator in an enumerator. Therefore, it seems a BUG to me, and
these methods should raise FrozenError if the receiver is frozen.

This fixed the following methods to raise FrozenError if the receiver is
frozen.

- `Enumerator#next`
- `Enumerator#next_values`
- `Enumerator#peek`
- `Enumerator#peek_values`
- `Enumerator#feed`
- `Enumerator#rewind`

* Fix a typo in the document

Thanks @Maumagnaguagno.</pre>
</div>
</content>
</entry>
<entry>
<title>Fix stack trace for rescued StopIteration</title>
<updated>2023-07-15T06:24:43+00:00</updated>
<author>
<name>Marcelo Pereira</name>
<email>marcelovitor.pereira@gmail.com</email>
</author>
<published>2022-07-29T13:09:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f15123c34ce80f3928612befe2a9aaf4c9d27fda'/>
<id>f15123c34ce80f3928612befe2a9aaf4c9d27fda</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Enumerartor.product return nil when called with a block</title>
<updated>2022-12-21T10:13:15+00:00</updated>
<author>
<name>Akinori MUSHA</name>
<email>knu@idaemons.org</email>
</author>
<published>2022-12-21T10:13:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cc4c28ec2efa71b1c8afb4ce11409ad7b5ca1c95'/>
<id>cc4c28ec2efa71b1c8afb4ce11409ad7b5ca1c95</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make product consistently yield an array of N elements instead of N arguments</title>
<updated>2022-12-21T09:19:19+00:00</updated>
<author>
<name>Akinori MUSHA</name>
<email>knu@idaemons.org</email>
</author>
<published>2022-12-21T09:19:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=308ccbaeb2c1c0e78d59c0411ddbeede8d2324f0'/>
<id>308ccbaeb2c1c0e78d59c0411ddbeede8d2324f0</id>
<content type='text'>
Inconsistency pointed out by @mame:

```
&gt;&gt; Enumerator.product([1], [2], [3]).to_a
=&gt; [[1, 2, 3]]
&gt;&gt; Enumerator.product([1], [2]).to_a
=&gt; [[1, 2]]
&gt;&gt; Enumerator.product([1]).to_a
=&gt; [1]
&gt;&gt; Enumerator.product().to_a
=&gt; [nil]
```

Got fixed as follows:

```
&gt;&gt; Enumerator.product([1], [2], [3]).to_a
=&gt; [[1, 2, 3]]
&gt;&gt; Enumerator.product([1], [2]).to_a
=&gt; [[1, 2]]
&gt;&gt; Enumerator.product([1]).to_a
=&gt; [[1]]
&gt;&gt; Enumerator.product().to_a
=&gt; [[]]
```

This was due to the nature of the N-argument funcall in Ruby.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Inconsistency pointed out by @mame:

```
&gt;&gt; Enumerator.product([1], [2], [3]).to_a
=&gt; [[1, 2, 3]]
&gt;&gt; Enumerator.product([1], [2]).to_a
=&gt; [[1, 2]]
&gt;&gt; Enumerator.product([1]).to_a
=&gt; [1]
&gt;&gt; Enumerator.product().to_a
=&gt; [nil]
```

Got fixed as follows:

```
&gt;&gt; Enumerator.product([1], [2], [3]).to_a
=&gt; [[1, 2, 3]]
&gt;&gt; Enumerator.product([1], [2]).to_a
=&gt; [[1, 2]]
&gt;&gt; Enumerator.product([1]).to_a
=&gt; [[1]]
&gt;&gt; Enumerator.product().to_a
=&gt; [[]]
```

This was due to the nature of the N-argument funcall in Ruby.
</pre>
</div>
</content>
</entry>
<entry>
<title>Reject keyword arguments given to Enumerator::Product.new</title>
<updated>2022-12-16T04:32:13+00:00</updated>
<author>
<name>Akinori MUSHA</name>
<email>knu@idaemons.org</email>
</author>
<published>2022-12-16T04:32:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ad18d1297ed82aa9c38375532b0b709131cf1ae7'/>
<id>ad18d1297ed82aa9c38375532b0b709131cf1ae7</id>
<content type='text'>
The use of keyword arguments should be reserved for future extension.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The use of keyword arguments should be reserved for future extension.
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement Enumerator::Product and Enumerator.product [Feature #18685]</title>
<updated>2022-07-30T11:05:14+00:00</updated>
<author>
<name>Akinori MUSHA</name>
<email>knu@idaemons.org</email>
</author>
<published>2022-07-29T04:56:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1a73a6cdd2068b815430b775fe25186dab693faa'/>
<id>1a73a6cdd2068b815430b775fe25186dab693faa</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
