summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2026-04-21[ruby/erb] Prohibit def_method on marshal-loaded ERB instancesTakashi Kokubun
Extends the @_init guard to def_method so that an ERB object created via Marshal.load (which bypasses initialize) raises ArgumentError instead of evaluating arbitrary source. def_module and def_class both delegate to def_method and are covered by the same check. Co-authored-by: Tristan Madani <TristanInSec@gmail.com>
2026-03-16merge revision(s) 08372635f7ec09f7115bd254246ebd637499651c: [Backport #21926]Takashi Kokubun
Fix race condition right after ubf registration Fixes [Bug #21926]
2026-03-16merge revision(s) f315d250b44e75a1a69f4a05b293dcc701377689: [Backport #21947]Takashi Kokubun
[ruby/timeout] Compatibility with Fiber scheduler. (https://github.com/ruby/timeout/pull/97) [Bug #21947]
2026-03-16merge revision(s) 55694ad7efc3f8dc6d5c7aefa60ded4c303ed6cf: [Backport #21945]Takashi Kokubun
[Bug #21945] Correctly handle `and?` and similar
2026-03-16YJIT: Fix not reading locals from `cfp->ep` after `YJIT.enable` and ↵Alan Wu
exceptional entry [Backport #21941] In case of `--yjit-disable`, YJIT only starts to record environment escapes after `RubyVM::YJIT.enable`. Previously we falsely assumed that we always have a full history all the way back to VM boot. This had YJIT install and run code that assume EP=BP when EP≠BP for some exceptional entry into the middle of a running frame, if the environment escaped before `YJIT.enable`. The fix is to reject exceptional entry with an escaped environment. Rename things and explain in more detail how the predicate for deciding to assume EP=BP works. It's quite subtle since it reasons about all parties in the system that push a control frame and then run JIT code. Note that while can_assume_on_stack_env() checks the currently running environment if it so happens to be the one YJIT is compiling against, it can return true for any ISEQ. The check isn't necessary for fixing the bug, and the load bearing part of this patch is the change to exceptional entries. This fix is flat on speed and space on ruby-bench headline benchmarks. Many thanks for the community effort to create a small test case for this bug.
2026-03-11Use $LOAD_PATH.replace for safer restoration in testHiroshi SHIBATA
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11Suppress bundled gems warning for subfeatures found outside stdlib [Bug #21828]Hiroshi SHIBATA
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09Merge zlib-3.2.3Hiroshi SHIBATA
2026-03-06[ruby/prism] Fix in handlingKevin Newton
in is a unique keyword because it can be the start of a clause or an infix keyword. We need to be explicitly sure that even though in _could_ close an expression context (the body of another in clause) that we are not also parsing an inline in. The exception is the case of a command call, which can never be the LHS of an expression, and so we must immediately exit. [Bug #21925] [Bug #21674] https://github.com/ruby/prism/commit/20374ced51
2026-03-06[ruby/prism] Fix error message for block/lambda with `...` argumentEarlopain
They currently complain that the parent method is not forwarding. But the actual problem is that these types of arguments simply don't accept `...` Fixes [Bug #21927] https://github.com/ruby/prism/commit/0aa2363331
2026-03-06[ruby/prism] Correctly handle `and?` and similar on ruby 4.0Earlopain
It gets confused for syntax introduced in https://bugs.ruby-lang.org/issues/20925 But it actually should be a plain method call. `!`/`?` are not valid as part of an identifier, methods however allow them as the last character. Fixes [Bug #21946] https://github.com/ruby/prism/commit/5d80bc5e1a
2026-02-12Fix bundled gems warning for all subfeatures of hyphenated gemsChris Hasiński
PR #15822 fixed the warning for direct hyphenated gem requires like `benchmark/ips` → `benchmark-ips`. However, hyphenated gems often provide multiple files under their namespace. For example, `benchmark-ips` provides: - benchmark/ips.rb - benchmark/timing.rb - benchmark/compare.rb When requiring `benchmark/timing`, the previous fix only checked for `benchmark-timing` gem (doesn't exist), not `benchmark-ips` which actually provides the file. This fix checks if ANY gem matching `{prefix}-*` is in the bundle specs, which covers all subfeatures provided by hyphenated gems. Reported in https://github.com/ruby/ruby/pull/15822#issuecomment-123456
2026-02-10ZJIT: Avoid runtime exceptions from RubyVM::ZJIT.stats_string (#16139)Takashi Kokubun
Before this it would raise if zjit wasn't enabled and raise a different exception if zjit was but extended stats were not (_some_ stats are available). Co-authored-by: Randy Stauner <randy@r4s6.net>
2026-02-10Fix UnboundMethod#== for methods from included/extended modules [Backport ↵Mike Dalessio
#21873] Method#unbind clones the method entry, preserving its defined_class. For methods mixed in via include/extend, defined_class is an ICLASS, causing UnboundMethod#== to return false when comparing against the same method obtained via Module#instance_method. Resolve ICLASS defined_class in method_eq. [Bug #21873]
2026-02-09Merge RubyGems/Bundler 4.0.5Hiroshi SHIBATA
2026-02-09merge revision(s) 78b7646bdb91285873ac26bca060591e06c45afe, ↵Takashi Kokubun
b4a62a1ca949d93332ad8bce0fcc273581160cc5: [Backport #21842] [PATCH] [Bug #21842] Let `rb_interned_str` return US-ASCII if possible [PATCH] [DOC] Update docs for rb_interned_str and related functions (#15897) Related to [Bug #21842]. * rb_interned_str: document what decides whether the returned string is in US-ASCII or BINARY encoding. * rb_interned_str_cstr: include the same description as rb_interned_str for the encoding. This one was still missing the update for US-ASCII and erroneously said the returned string was alwasy in BINARY encoding * rb_str_to_interned_str: document how the encoding of the result is defined. Co-authored-by: Herwin <herwinw@users.noreply.github.com>
2026-02-09Fix signal crash during keyword argument callJohn Hawthorn
64f508ade8 changed rb_threadptr_raise to call rb_exception_setup, which uses rb_scan_args with RB_SCAN_ARGS_PASS_CALLED_KEYWORDS. This checked rb_keyword_given_p(), which read the interrupted frame's keyword state rather than the signal raise arguments, causing a crash when a signal arrived during a keyword call. Revert rb_threadptr_raise to use rb_make_exception directly, and have thread_raise_m call rb_exception_setup where rb_keyword_given_p() reflects the correct frame. [Bug #21865]
2026-01-13Add a test backport missed at a10f7fac1fb1dcbdb1ae41137bd7294764a34793Takashi Kokubun
https://bugs.ruby-lang.org/issues/21831
2026-01-12Sync Prism to 1.8.0Takashi Kokubun
2026-01-12merge revision(s) 7e81bf5c0c8f43602e6d901f4253dca2f3d71745: [Backport #21812]Takashi Kokubun
[PATCH] Fix sleep spurious wakeup from sigchld (#15802) When sleeping with `sleep`, currently the main thread can get woken up from sigchld from any thread (subprocess exited). The timer thread wakes up the main thread when this happens, as it checks for signals. The main thread then executes the ruby sigchld handler if one is registered and is supposed to go back to sleep immediately. This is not ideal but it's the way it's worked for a while. In commit 8d8159e7d8 I added writes to `th->status` before and after `wait_running_turn` in `thread_sched_to_waiting_until_wakeup`, which is called from `sleep`. This is usually the right way to set the thread's status, but `sleep` is an exception because the writes to `th->status` are done in `sleep_forever`. There's a loop that checks `th->status` in `sleep_forever`. When the main thread got woken up from sigchld it saw the changed `th->status` and continued to run the main thread instead of going back to sleep. The following script shows the error. It was returning instead of sleeping forever. ```ruby t = Thread.new do sleep 0.3 `echo hello` # Spawns subprocess puts "Subprocess exited" end puts "Main thread sleeping..." result = sleep # Should block forever puts "sleep returned: #{result.inspect}" ``` Fixes [Bug #21812]
2026-01-12merge revision(s) d7a6ff8224519005d2deeb3f4e98689a8a0835ad: [Backport #21819]Takashi Kokubun
[PATCH] [Bug #21819] Data objects without members should also be frozen
2026-01-12merge revision(s) 19e539c9ee1701b34189fa0c1feb942adeb0e326: [Backport #21814]Takashi Kokubun
[PATCH] [Bug #21814] Fix negative bignum modulo If modulo is zero, do not apply bias even if the divisor is zero. `BIGNUM_POSITIVE_P` is true even on bignum zero.
2026-01-08Fix incorrect bundled gems warning for hyphenated gem namesChris Hasiński
When requiring a file like "benchmark/ips", the warning system would incorrectly warn about the "benchmark" gem not being a default gem, even when the user has "benchmark-ips" (a separate third-party gem) in their Gemfile. The fix checks if a hyphenated version of the require path exists in the bundle specs before issuing a warning. For example, requiring "benchmark/ips" now checks for both "benchmark" and "benchmark-ips" in the Gemfile. [Bug #21828]
2026-01-05Box: allocate classes as boxable when it happens in the root boxSatoshi Tagomori
Without this change, classes (including iclass) are allocated as un-boxable classes after initializing user boxes (after starting script evaluation). Under this situation, iclasses are created as un-boxabled class when core modules are included by a class in the root box, then it causes problems because it's in the root box but it can't have multiple classexts. This change makes it possible to allocate boxable classes even after initializing user boxes. Classes create in the root box will be boxable, and those can have 2 or more classexts.
2025-12-24Revert "Add link to Ruby options doc in help text"NARUSE, Yui
This reverts commit 31ff07ed1eb05d01f7da3c017d542137a3db1e94. * Don't add a test which only runs on production release * https://github.com/ruby/actions/actions/runs/20486784889/job/58870959976 * Don't add a new line to `ruby --help` * https://github.com/ruby/ruby/pull/14142#issuecomment-3689829564
2025-12-24Revert "Extract `ruby_api_version_name`"NARUSE, Yui
This reverts commit 9b576cd6255aba97e5e2f55f4b09f00c7dd0e839.
2025-12-24Fix a fragile testNobuyoshi Nakada
`Dir.mktmpdir` concatenates a random base-36 number separated by "-", so may generate pathnames containing "-j2".
2025-12-24Prevent "warning: assigned but unused variable - it"Yusuke Endoh
2025-12-24Remove unintentional returnYusuke Endoh
2025-12-24Box: show the fully qualified URL of the Ruby::Box docSatoshi Tagomori
2025-12-24[Tests] Assert Module#set_temporary_name returns selfaguspe
The return value of Module#set_temporary_name was changed to return `self`, but the existing tests did not verify this.
2025-12-24Tidy up fiber scheduler tests.Samuel Williams
2025-12-24Fix flaky test.Samuel Williams
2025-12-23Box: split the test for CI timeoutsSatoshi Tagomori
2025-12-23Fix a fragile testNobuyoshi Nakada
`Dir.mktmpdir` concatenates a random base-36 number separated by "-", so may generate pathnames containing "-j4".
2025-12-23Merge RubyGems 4.0.3 and Bundler 4.0.3Hiroshi SHIBATA
2025-12-20Test test_remove_instance_variable_re_embed separatelyPeter Zhu
Shape tree pollution could cause this test to flake.
2025-12-20Change test to define ivars in initialize methodPeter Zhu
Defining ivars in initialize method guarantees the object to be embedded.
2025-12-20Exclude TestObjSpace#test_dump_objects_dumps_page_slot_sizes for MMTk [ci skip]Peter Zhu
2025-12-20Fix a fragile testNobuyoshi Nakada
`Dir.mktmpdir` concatenates a random base-36 number separated by "-", so may generate pathnames containing "-j4".
2025-12-20Revert pack/unpack support for LEB128Nobuyoshi Nakada
https://bugs.ruby-lang.org/issues/21785#note-10 > It is too late to introduce it in Ruby 4.0, let's aim for 4.1. This reverts commits: * d0b72429a93e54f1f956b4aedfc25c57dc7001aa Add support for signed and unsigned LEB128 to pack/unpack. * 68a900e30b4ca1537d7975c3a619fd94fca7b084 add news for pack / unpack directives
2025-12-20fix for a test case that depends on rbuf sizeYO4
2025-12-20skip TestFiberScheduler#test_io_write_on_flush because it makes GC.stat test ↵Koichi Sasada
fragile
2025-12-19Fiber scheduler: invoke `#io_write` hook on IO flush (#15609)Sharon Rosner
Previously, calling IO#flush or closing an IO with unflushed buffered writes would just invoke `#blocking_operation_wait` and flush the write buffer using a `write` syscall. This change adds flushing through the fiber scheduler by invoking the `#io_write` hook. * Prefer IO::Buffer#write in IOScheduler * Use Dir.tmpdir for test file * Correctly handle errors in io_flush_buffer_fiber_scheduler
2025-12-19Fix: Specifying 0 should cause an immediate timeout (#15641)Misaki Shioi
This change fixes a bug in which specifying 0 for timeout-related options (such as the `timeout` option of `Addrinfo.getaddrinfo`) incorrectly results in an infinite wait. (This change overwrites https://github.com/ruby/ruby/pull/15626 .)
2025-12-18[ruby/prism] Reject `p(p a, &block => value)` and similarEarlopain
Redo of https://github.com/ruby/prism/pull/3669 with more tests https://github.com/ruby/prism/commit/48b403ea79
2025-12-18[ruby/prism] Add Ruby 4.1 as a version specifierEarlopain
https://github.com/ruby/prism/commit/138db9ccc4
2025-12-18[ruby/prism] Fix assertions in location_test.rbBenoit Daloze
* assert_raise's 2nd argument is the failure message, shown when the expected exception is not raised. It's not the expected message. See https://github.com/test-unit/test-unit/issues/347 https://github.com/ruby/prism/commit/e3df994d47
2025-12-18Add support for signed and unsigned LEB128 to pack/unpack.Aaron Patterson
This commit adds a new pack format command `R` and `r` for unsigned and signed LEB128 encoding. The "r" mnemonic is because this is a "vaRiable" length encoding scheme. LEB128 is used in various formats including DWARF, WebAssembly, MQTT, and Protobuf. [Feature #21785]
2025-12-18make rb_singleton_class ractor safe (#15591)Luke Gruber
Since singleton classes are created lazily, we need to make sure that we lock around their creation. Unfortunately, that means we need to lock around every shareable object's call to `singleton_class`, including classes and modules.