| Age | Commit message (Collapse) | Author |
|
[Bug #21780]
|
|
[Bug #21780]
|
|
When not specified, the size is unknown (`nil`). Previously, the size was always `Float::INFINITY` and not specifiable.
[Feature #21701]
|
|
These two class are most common sources of infinite sequences. This change should effectively prevent accidental infinite loops when calling to_set on them. [Bug #21513]
|
|
After switching to `Float`-mode when summing `Numeric` objects,
normalization for `Float` is still needed.
Notes:
Merged: https://github.com/ruby/ruby/pull/12522
|
|
|
|
|
|
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)
|
|
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
|
|
* 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.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6201
|
|
|
|
Inconsistency pointed out by @mame:
```
>> Enumerator.product([1], [2], [3]).to_a
=> [[1, 2, 3]]
>> Enumerator.product([1], [2]).to_a
=> [[1, 2]]
>> Enumerator.product([1]).to_a
=> [1]
>> Enumerator.product().to_a
=> [nil]
```
Got fixed as follows:
```
>> Enumerator.product([1], [2], [3]).to_a
=> [[1, 2, 3]]
>> Enumerator.product([1], [2]).to_a
=> [[1, 2]]
>> Enumerator.product([1]).to_a
=> [[1]]
>> Enumerator.product().to_a
=> [[]]
```
This was due to the nature of the N-argument funcall in Ruby.
|
|
The use of keyword arguments should be reserved for future extension.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6197
|
|
|
|
Previously these methods were defined but raised TypeError, which
seems worse.
Notes:
Merged: https://github.com/ruby/ruby/pull/3811
|
|
Implements [Feature #17347]
Notes:
Merged: https://github.com/ruby/ruby/pull/3811
|
|
This previously raised a TypeError. Wrap the Enumerator::Chain in
an Enumerator to work around the problem.
Fixes [Bug #17216]
Notes:
Merged: https://github.com/ruby/ruby/pull/3811
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3851
|
|
Has been deprecated since c73b6bd7ebd01133538c645566944132dbde4d13.
[Feature #17116] [ruby-dev:50945]
Notes:
Merged: https://github.com/ruby/ruby/pull/3968
|
|
by explicitly setting `Warning[:deprecated] = true`.
I removed "capture_io" at 79063d8cbfb7ce4740774289252a2a20dc9a5dc1, but
it printed the warning when `RUBYOPT=-w`.
This change makes the warnings enabled explicitly, capture and check the
warning.
|
|
The deprecation warning was disabled, and the code to check the warning
was removed at 996af2ce086249e904b2ce95ab2fcd1de7d757be, thus capture_io
is no longer needed.
|
|
And `-w` option turns it on.
Notes:
Merged: https://github.com/ruby/ruby/pull/3481
|
|
Previously, lambdas were converted to procs because of how
rb_block_call works. Switch to rb_funcall_with_block, which
handles procs as procs and lambdas as lambdas.
Fixes [Bug #15613]
Notes:
Merged: https://github.com/ruby/ruby/pull/2720
|
|
Currently, there is not a way to create a sized enumerator in C
with a different set of arguments than provided by Ruby, and
correctly handle keyword arguments. This function allows that.
The need for this is fairly uncommon, but it occurs at least in
Enumerator.produce, which takes arugments from Ruby but calls
rb_enumeratorize_with_size with a different set of arguments.
Notes:
Merged: https://github.com/ruby/ruby/pull/2509
|
|
Co-authored-by: Victor Shepelev <zverok.offline@gmail.com>
|
|
Fixes [Bug #15889]
|
|
[Feature #15323]
Closes: https://github.com/ruby/ruby/pull/2017
|
|
A Yielder object can now be directly passed to another method as a
block argument.
```ruby
enum = Enumerator.new { |y|
Dir.glob("*.rb") { |file|
File.open(file) { |f| f.each_line(&y) }
}
}
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[ruby-core:90685] [Bug #15455]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
They return an Enumerator::Chain object which is a subclass of
Enumerator, which represents a chain of enumerables that works as a
single enumerator.
```ruby
e = (1..3).chain([4, 5])
e.to_a #=> [1, 2, 3, 4, 5]
e = (1..3).each + [4, 5]
e.to_a #=> [1, 2, 3, 4, 5]
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
to nil
When each() takes arguments, it is never safe to assume that the iteration
would repeat the same number of times as with each() without any
argument. Actually, there is no way to get the exact number, so the
size should be set to nil to denote that.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
This commit introduces new core class Enumerator::ArithmeticSequence.
Enumerator::ArithmeticSequence is a subclass of Enumerator, and
represents a number generator of an arithmetic sequence.
After this commit, Numeric#step and Range#step without blocks
returned an ArithmeticSequence object instead of an Enumerator.
This class introduces the following incompatibilities:
- You can create a zero-step ArithmeticSequence,
and its size is not ArgumentError, but Infinity.
- You can create a negative-step ArithmeticSequence from a range.
[ruby-core:82816] [Feature #13904]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/ruby/test_enumerator.rb (test_uniq): remove assertions
which ared duplicate of lazy enumerator tests in
test_lazy_enumerator.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* enumerator.c (lazy_uniq_i): create new hash for each calls.
[Fix GH-1820]
Currently
2.5.0-preview1 :001 > arr = (0..100).lazy.uniq{|i| i % 10}
=> #<Enumerator::Lazy: #<Enumerator::Lazy: 0..100>:uniq>
2.5.0-preview1 :002 > arr.to_a
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2.5.0-preview1 :003 > arr.to_a
=> []
Expected
arr.to_a to always return same output
From: Anmol Chopra <anmolchopra@rocketbox.in>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* In Enumerable, Enumerator::Lazy, Array, Hash and Set
[Feature #13784] [ruby-core:82285]
* Share specs for the various #select#select! methods and
reuse them for #filter/#filter!.
* Add corresponding filter tests for select tests.
* Update NEWS.
[Fix GH-1824]
From: Alexander Patrick <adp90@case.edu>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
FrozenError will be used instead of RuntimeError for exceptions
raised when there is an attempt to modify a frozen object. The
reason for this change is to differentiate exceptions related
to frozen objects from generic exceptions such as those generated
by Kernel#raise without an exception class.
From: Jeremy Evans <code@jeremyevans.net>
Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* enum.c (enum_cycle_size): check an argument before the size of
the receiver, if it is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
Patch by Kenichi Kamiya
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* enumerator.c (lazy_uniq): new method Enumerator::Lazy#uniq.
[Feature #11090]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_eval.c (rb_f_loop): When a loop is stopped by a StopIteration
exception, return what the enumerator has returned instead of
nil. [ruby-core:71133] [Feature #11498]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/lib/find_executable.rb: Ditto.
* test/lib/memory_status.rb: Ditto.
* test/lib/test/unit.rb: require envutil.
* test/: Don't require envutil in test files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/ruby/test_enumerator.rb (test_iterators): fix test for hash
iterators. [Fixes GH-558]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* hash.c (rb_hash_reject): copy unrejected elements only to new hash,
so that the change on the original receiver can affect.
[ruby-core:58914] [Bug #9223]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|