Skip to content

Commit f0f5320

Browse files
committed
New upstream version 3.3.2
1 parent 472de69 commit f0f5320

File tree

212 files changed

+12004
-10682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+12004
-10682
lines changed

ChangeLog

Lines changed: 997 additions & 0 deletions
Large diffs are not rendered by default.

array.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,6 +3387,9 @@ rb_ary_sort_bang(VALUE ary)
33873387
rb_ary_unshare(ary);
33883388
FL_SET_EMBED(ary);
33893389
}
3390+
if (ARY_EMBED_LEN(tmp) > ARY_CAPA(ary)) {
3391+
ary_resize_capa(ary, ARY_EMBED_LEN(tmp));
3392+
}
33903393
ary_memcpy(ary, 0, ARY_EMBED_LEN(tmp), ARY_EMBED_PTR(tmp));
33913394
ARY_SET_LEN(ary, ARY_EMBED_LEN(tmp));
33923395
}

bootstraptest/test_ractor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ class C
15321532
15331533
1_000.times { idle_worker, tmp_reporter = Ractor.select(*workers) }
15341534
"ok"
1535-
} unless ENV['RUN_OPTS'] =~ /rjit/ # flaky
1535+
} unless ENV['RUN_OPTS'] =~ /rjit/ || ENV.key?('CI') # flaky
15361536

15371537
assert_equal "ok", %q{
15381538
def foo(*); ->{ super }; end

bootstraptest/test_yjit.rb

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,77 @@
1+
# regression test for popping before side exit
2+
assert_equal "ok", %q{
3+
def foo(a, *) = a
4+
5+
def call(args, &)
6+
foo(1) # spill at where the block arg will be
7+
foo(*args, &)
8+
end
9+
10+
call([1, 2])
11+
12+
begin
13+
call([])
14+
rescue ArgumentError
15+
:ok
16+
end
17+
}
18+
19+
# regression test for send processing before side exit
20+
assert_equal "ok", %q{
21+
def foo(a, *) = :foo
22+
23+
def call(args)
24+
send(:foo, *args)
25+
end
26+
27+
call([1, 2])
28+
29+
begin
30+
call([])
31+
rescue ArgumentError
32+
:ok
33+
end
34+
}
35+
36+
# test discarding extra yield arguments
37+
assert_equal "2210150001501015", %q{
38+
def splat_kw(ary) = yield *ary, a: 1
39+
40+
def splat(ary) = yield *ary
41+
42+
def kw = yield 1, 2, a: 0
43+
44+
def simple = yield 0, 1
45+
46+
def calls
47+
[
48+
splat([1, 1, 2]) { |x, y| x + y },
49+
splat([1, 1, 2]) { |y, opt = raise| opt + y},
50+
splat_kw([0, 1]) { |a:| a },
51+
kw { |a:| a },
52+
kw { |a| a },
53+
simple { 5.itself },
54+
simple { |a| a },
55+
simple { |opt = raise| opt },
56+
simple { |*rest| rest },
57+
simple { |opt_kw: 5| opt_kw },
58+
# autosplat ineractions
59+
[0, 1, 2].yield_self { |a, b| [a, b] },
60+
[0, 1, 2].yield_self { |a, opt = raise| [a, opt] },
61+
[1].yield_self { |a, opt = 4| a + opt },
62+
]
63+
end
64+
65+
calls.join
66+
}
67+
68+
# test autosplat with empty splat
69+
assert_equal "ok", %q{
70+
def m(pos, splat) = yield pos, *splat
71+
72+
m([:ok], []) {|v0,| v0 }
73+
}
74+
175
# regression test for send stack shifting
276
assert_normal_exit %q{
377
def foo(a, b)
@@ -11,6 +85,13 @@ def call_foo
1185
call_foo
1286
}
1387

88+
# regression test for keyword splat with yield
89+
assert_equal 'nil', %q{
90+
def splat_kw(kwargs) = yield(**kwargs)
91+
92+
splat_kw({}) { _1 }.inspect
93+
} unless rjit_enabled? # Not yet working on RJIT
94+
1495
# regression test for arity check with splat
1596
assert_equal '[:ae, :ae]', %q{
1697
def req_one(a_, b_ = 1) = raise
@@ -4342,3 +4423,34 @@ def entry
43424423
43434424
entry
43444425
}
4426+
4427+
# Integer succ and overflow
4428+
assert_equal '[2, 4611686018427387904]', %q{
4429+
[1.succ, 4611686018427387903.succ]
4430+
}
4431+
4432+
# Integer right shift
4433+
assert_equal '[0, 1, -4]', %q{
4434+
[0 >> 1, 2 >> 1, -7 >> 1]
4435+
}
4436+
4437+
assert_equal '[nil, "yield"]', %q{
4438+
def defined_yield = defined?(yield)
4439+
[defined_yield, defined_yield {}]
4440+
}
4441+
4442+
# splat with ruby2_keywords into rest parameter
4443+
assert_equal '[[{:a=>1}], {}]', %q{
4444+
ruby2_keywords def foo(*args) = args
4445+
4446+
def bar(*args, **kw) = [args, kw]
4447+
4448+
def pass_bar(*args) = bar(*args)
4449+
4450+
def body
4451+
args = foo(a: 1)
4452+
pass_bar(*args)
4453+
end
4454+
4455+
body
4456+
}

compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7097,6 +7097,7 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
70977097
case NODE_COLON2:
70987098
case NODE_COLON3:
70997099
case NODE_BEGIN:
7100+
case NODE_BLOCK:
71007101
CHECK(COMPILE(ret, "case in literal", node)); // (1)
71017102
if (in_single_pattern) {
71027103
ADD_INSN1(ret, line_node, dupn, INT2FIX(2));

complex.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,8 +2321,11 @@ nucomp_convert(VALUE klass, VALUE a1, VALUE a2, int raise)
23212321
return a1;
23222322
/* should raise exception for consistency */
23232323
if (!k_numeric_p(a1)) {
2324-
if (!raise)
2325-
return rb_protect(to_complex, a1, NULL);
2324+
if (!raise) {
2325+
a1 = rb_protect(to_complex, a1, NULL);
2326+
rb_set_errinfo(Qnil);
2327+
return a1;
2328+
}
23262329
return to_complex(a1);
23272330
}
23282331
}

configure

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,6 +3622,7 @@ tooldir="$srcdir/tool"
36223622

36233623

36243624

3625+
36253626
msg_checking= msg_result_yes= msg_result_no= msg_result_other= msg_reset=
36263627
case "x${CONFIGURE_TTY}" in #(
36273628
xyes|xalways) :
@@ -13984,13 +13985,17 @@ esac
1398413985

1398513986
if test "x$with_gmp" != xno
1398613987
then :
13987-
ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
13988+
# RUBY_CHECK_HEADER([gmp.h])
13989+
save_CPPFLAGS="$CPPFLAGS"
13990+
CPPFLAGS="$CPPFLAGS $INCFLAGS"
13991+
ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
1398813992
if test "x$ac_cv_header_gmp_h" = xyes
1398913993
then :
13990-
printf "%s\n" "#define HAVE_GMP_H 1" >>confdefs.h
1399113994

1399213995
fi
1399313996

13997+
CPPFLAGS="$save_CPPFLAGS"
13998+
unset save_CPPFLAGS
1399413999
if test "x$ac_cv_header_gmp_h" != xno
1399514000
then :
1399614001
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing __gmpz_init" >&5
@@ -14069,6 +14074,8 @@ if test "x$with_jemalloc" != xno
1406914074
then :
1407014075

1407114076
# find jemalloc header first
14077+
save_CPPFLAGS="${CPPFLAGS}"
14078+
CPPFLAGS="${INCFLAGS} ${CPPFLAGS}"
1407214079
malloc_header=
1407314080
ac_fn_c_check_header_compile "$LINENO" "jemalloc/jemalloc.h" "ac_cv_header_jemalloc_jemalloc_h" "$ac_includes_default"
1407414081
if test "x$ac_cv_header_jemalloc_jemalloc_h" = xyes
@@ -14139,6 +14146,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
1413914146
fi
1414014147
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $rb_cv_jemalloc_library" >&5
1414114148
colorize_result "$rb_cv_jemalloc_library" ; }
14149+
CPPFLAGS="${save_CPPFLAGS}"
14150+
unset save_CPPFLAGS
1414214151
with_jemalloc=${rb_cv_jemalloc_library}
1414314152
case "$with_jemalloc" in #(
1414414153
no) :

configure.ac

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ m4_include([tool/m4/ruby_append_option.m4])dnl
1616
m4_include([tool/m4/ruby_append_options.m4])dnl
1717
m4_include([tool/m4/ruby_check_builtin_func.m4])dnl
1818
m4_include([tool/m4/ruby_check_builtin_setjmp.m4])dnl
19+
m4_include([tool/m4/ruby_check_header.m4])dnl
1920
m4_include([tool/m4/ruby_check_printf_prefix.m4])dnl
2021
m4_include([tool/m4/ruby_check_setjmp.m4])dnl
2122
m4_include([tool/m4/ruby_check_signedness.m4])dnl
@@ -1363,7 +1364,7 @@ AS_CASE("$target_cpu", [x64|x86_64|i[3-6]86*], [
13631364
RUBY_UNIVERSAL_CHECK_HEADER([x86_64, i386], x86intrin.h)
13641365

13651366
AS_IF([test "x$with_gmp" != xno],
1366-
[AC_CHECK_HEADERS(gmp.h)
1367+
[RUBY_CHECK_HEADER(gmp.h)
13671368
AS_IF([test "x$ac_cv_header_gmp_h" != xno],
13681369
AC_SEARCH_LIBS([__gmpz_init], [gmp],
13691370
[AC_DEFINE(HAVE_LIBGMP, 1)]))])
@@ -1373,6 +1374,8 @@ AC_ARG_WITH([jemalloc],
13731374
[with_jemalloc=$withval], [with_jemalloc=no])
13741375
AS_IF([test "x$with_jemalloc" != xno],[
13751376
# find jemalloc header first
1377+
save_CPPFLAGS="${CPPFLAGS}"
1378+
CPPFLAGS="${INCFLAGS} ${CPPFLAGS}"
13761379
malloc_header=
13771380
AC_CHECK_HEADER(jemalloc/jemalloc.h, [malloc_header=jemalloc/jemalloc.h], [
13781381
AC_CHECK_HEADER(jemalloc.h, [malloc_header=jemalloc.h])
@@ -1404,6 +1407,8 @@ AS_IF([test "x$with_jemalloc" != xno],[
14041407
done
14051408
done
14061409
])
1410+
CPPFLAGS="${save_CPPFLAGS}"
1411+
unset save_CPPFLAGS
14071412
with_jemalloc=${rb_cv_jemalloc_library}
14081413
AS_CASE(["$with_jemalloc"],
14091414
[no],

cont.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,7 +2378,7 @@ rb_fiber_initialize(int argc, VALUE* argv, VALUE self)
23782378
VALUE
23792379
rb_fiber_new_storage(rb_block_call_func_t func, VALUE obj, VALUE storage)
23802380
{
2381-
return fiber_initialize(fiber_alloc(rb_cFiber), rb_proc_new(func, obj), rb_fiber_pool_default(Qnil), 1, storage);
2381+
return fiber_initialize(fiber_alloc(rb_cFiber), rb_proc_new(func, obj), rb_fiber_pool_default(Qnil), 0, storage);
23822382
}
23832383

23842384
VALUE
@@ -3223,7 +3223,13 @@ rb_fiber_s_yield(int argc, VALUE *argv, VALUE klass)
32233223
static VALUE
32243224
fiber_raise(rb_fiber_t *fiber, VALUE exception)
32253225
{
3226-
if (FIBER_SUSPENDED_P(fiber) && !fiber->yielding) {
3226+
if (fiber == fiber_current()) {
3227+
rb_exc_raise(exception);
3228+
}
3229+
else if (fiber->resuming_fiber) {
3230+
return fiber_raise(fiber->resuming_fiber, exception);
3231+
}
3232+
else if (FIBER_SUSPENDED_P(fiber) && !fiber->yielding) {
32273233
return fiber_transfer_kw(fiber, -1, &exception, RB_NO_KEYWORDS);
32283234
}
32293235
else {

doc/irb/indexes.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ for each entry that is pre-defined, the initial value is given:
165165
- `:RC`: Whether a {configuration file}[rdoc-ref:IRB@Configuration+File]
166166
was found and interpreted;
167167
initial value: `true` if a configuration file was found, `false` otherwise.
168-
- `:RC_NAME_GENERATOR`: \Proc to generate paths of potential
169-
{configuration files}[rdoc-ref:IRB@Configuration+File];
170-
initial value: `=> #<Proc:0x000055f9bebfed80 /var/lib/gems/3.0.0/gems/irb-1.8.3/lib/irb/init.rb:401>`.
171168
- `:SAVE_HISTORY`: Number of commands to save in
172169
{input command history}[rdoc-ref:IRB@Input+Command+History];
173170
initial value: `1000`.

0 commit comments

Comments
 (0)