Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion debug_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ RB_DEBUG_COUNTER(obj_imemo_ment)
RB_DEBUG_COUNTER(obj_imemo_iseq)
RB_DEBUG_COUNTER(obj_imemo_env)
RB_DEBUG_COUNTER(obj_imemo_tmpbuf)
RB_DEBUG_COUNTER(obj_imemo_ast)
RB_DEBUG_COUNTER(obj_imemo_cref)
RB_DEBUG_COUNTER(obj_imemo_svar)
RB_DEBUG_COUNTER(obj_imemo_throw_data)
Expand Down
1 change: 0 additions & 1 deletion ext/objspace/objspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ count_imemo_objects(int argc, VALUE *argv, VALUE self)
INIT_IMEMO_TYPE_ID(imemo_ment);
INIT_IMEMO_TYPE_ID(imemo_iseq);
INIT_IMEMO_TYPE_ID(imemo_tmpbuf);
INIT_IMEMO_TYPE_ID(imemo_ast);
INIT_IMEMO_TYPE_ID(imemo_callinfo);
INIT_IMEMO_TYPE_ID(imemo_callcache);
INIT_IMEMO_TYPE_ID(imemo_constcache);
Expand Down
13 changes: 0 additions & 13 deletions imemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ rb_imemo_name(enum imemo_type type)
// put no default case to get a warning if an imemo type is missing
switch (type) {
#define IMEMO_NAME(x) case imemo_##x: return #x;
IMEMO_NAME(ast);
IMEMO_NAME(callcache);
IMEMO_NAME(callinfo);
IMEMO_NAME(constcache);
Expand Down Expand Up @@ -220,10 +219,6 @@ rb_imemo_memsize(VALUE obj)
{
size_t size = 0;
switch (imemo_type(obj)) {
case imemo_ast:
rb_bug("imemo_ast is obsolete");

break;
case imemo_callcache:
break;
case imemo_callinfo:
Expand Down Expand Up @@ -336,10 +331,6 @@ void
rb_imemo_mark_and_move(VALUE obj, bool reference_updating)
{
switch (imemo_type(obj)) {
case imemo_ast:
rb_bug("imemo_ast is obsolete");

break;
case imemo_callcache: {
/* cc is callcache.
*
Expand Down Expand Up @@ -600,10 +591,6 @@ void
rb_imemo_free(VALUE obj)
{
switch (imemo_type(obj)) {
case imemo_ast:
rb_bug("imemo_ast is obsolete");

break;
case imemo_callcache:
RB_DEBUG_COUNTER_INC(obj_imemo_callcache);

Expand Down
1 change: 0 additions & 1 deletion internal/imemo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ enum imemo_type {
imemo_ment = 6,
imemo_iseq = 7,
imemo_tmpbuf = 8,
imemo_ast = 9, // Obsolete due to the universal parser
imemo_callinfo = 10,
imemo_callcache = 11,
imemo_constcache = 12,
Expand Down
8 changes: 8 additions & 0 deletions set.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,14 @@ set_i_initialize(int argc, VALUE *argv, VALUE set)
}
}
else {
ID id_size = rb_intern("size");
if (rb_obj_is_kind_of(other, rb_mEnumerable) && rb_respond_to(other, id_size)) {
VALUE size = rb_funcall(other, id_size, 0);
if (RB_TYPE_P(size, T_FLOAT) && RFLOAT_VALUE(size) == INFINITY) {
rb_raise(rb_eArgError, "cannot initialize Set from an object with infinite size");
}
}

rb_block_call(other, enum_method_id(other), 0, 0,
rb_block_given_p() ? set_initialize_with_block : set_initialize_without_block,
set);
Expand Down
14 changes: 14 additions & 0 deletions test/ruby/test_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ def test_s_new

s = Set.new(ary) { |o| o * 2 }
assert_equal([2,4,6], s.sort)

assert_raise(ArgumentError) {
Set.new((1..))
}
assert_raise(ArgumentError) {
Set.new((1..), &:succ)
}
assert_raise(ArgumentError) {
Set.new(1.upto(Float::INFINITY))
}

assert_raise(ArgumentError) {
Set.new(Object.new)
}
end

def test_clone
Expand Down
1 change: 0 additions & 1 deletion yjit/src/cruby_bindings.inc.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion zjit/src/cruby_bindings.inc.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.