summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
28 hoursmerge revision(s) d077df24a2256d760cc534b242b28822d4ef6376: [Backport #22002]Takashi Kokubun
[Bug #22002] Never pop when compiling branch predicate The value is always needed. Now prism emits the same instructions as parse.y for the added test case. `defined?`/`flip-flop` caused `argument stack underflow`, `and`/`or` segfaulted during runtime.
29 hoursmerge revision(s) ↵Takashi Kokubun
c0d86a0103de7130943d54b4a290b76ec7e0c135,47e061277ac194a36659510bcf4f3190bde629a6: [Backport #21952] class.c: rb_class_duplicate_classext also dup content of cvc_tbl [Bug #21952] Shallow copying the table result in the same memory being shared between multiple box, causing double free when one of the box is garbage collected. --- class.c: Make cvc_tbl a managed object [Bug #21952] Solves the double-free or use after-free concern with boxes. Now entries can safely be used for copy-on-write. Also is likely necessary to make it save to read cvar from secondary ractors, as allowed since: ab32c0e690b805cdaaf264ad4c3421696c588204
29 hoursmerge revision(s) 7f4f3c8ee7cde795dc27be753796fc7ea8318565: [Backport #22004]Takashi Kokubun
[PATCH] [Bug #22004] Fix short-circuited loop conditions
29 hoursmerge revision(s) f89b07ef0046257dd796a2e615cc063072114f16: [Backport #21940]Takashi Kokubun
[PATCH] Mark `$_` as box-dynamic to bypass Box gvar_tbl cache `$_` is updated through svar (rb_lastline_set), bypassing rb_gvar_set, so the Box gvar_tbl cache is never invalidated and returns a stale value. Call rb_gvar_box_dynamic so gvar_use_box_tbl() skips the cache. Fixes [Bug #21940](https://bugs.ruby-lang.org/issues/21940)
29 hoursmerge revision(s) 526344b56ea968d5704bdefe6e10bb3cf7f4f569, ↵Takashi Kokubun
8ad6baa01746e8de0460f0ccdaee69953a70af17: [Backport #21933] [PATCH] Fix Box regexp match vars after non-match [PATCH] Use box_ready for $&, $`, $\', $+ These variables have rb_gvar_readonly_setter, so box_ready is sufficient. Only $~ needs box_dynamic due to its custom match_setter.
29 hoursmerge revision(s) 4644e4f2fafe45e2c49f18bc9712d0f5fff3d341: [Backport #21986]Takashi Kokubun
[PATCH] [Bug #21986] Fix location of numeric literal When checking for suffixes, do not flush the numeric literal token even if no suffix is found.
29 hoursmerge revision(s) 24a2ba09af13b7c969733ea9370ad59d2442f4c9: [Backport #21985]Takashi Kokubun
[PATCH] [Bug #21985] Include the `-` in the negative numbers location
8 days- iseq.c: fix passing frozen option to compile_file_prismVladimir Dementyev
8 daysFix coverage support for RubyVM::ISeq.compileJean Boussier
[Bug #22018] ISeq returned by `RubyVM::InstructionSequene.load_iseq` weren't handled by the coverage module.
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-04-14iseq.c: rb_estimate_iv_count handle no superclassJean Boussier
[Bug #21992] When redefining `BasicObject#initialize` there's no super class to access.
2026-04-08Merge RubyGems/Bundler 4.0.10Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.9Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.8Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.7Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.6Hiroshi SHIBATA
2026-04-03merge revision(s) c27ae8d91aadca0660070ee1eeae9598b1fe47ee, ↵Takashi Kokubun
b6e6ccc6c22ebb464ce101e42a14e7daea2a80b6, cbca59377ebfa1bc1183322fa9d9d0067d445c24: [Backport #21844] [ruby/psych] Remove excessive check of message Make `Data#initialize` reject `Integer` keys [Bug #21844] Fix error message
2026-04-03merge revision(s) 8ecf28f9384207590be73d5f2a95859cff9c526a: [Backport #21954]Takashi Kokubun
[ruby/rubygems] Fix NoMethodError in Gem.try_activate when activation conflicts occur
2026-04-03merge revision(s) 54c4694994cc3bcfea9058b22ba3e68af6aaf740: [Backport #21961]Takashi Kokubun
marshal.c: properly freeze linked strings
2026-03-30Run GC if fiber pool expansion fails. (#16535)Samuel Williams
[Bug #21964]
2026-03-19Simplify subclasses list, remove from BoxJohn Hawthorn
Currently we maintain the subclasses list for two separate purposes (we essentially have to different relationships we're putting into the same list): 1. On a T_MODULE, we track the T_ICLASSes created to include it into other classes. Used for method invalidation and propagating includes on the module that happen after it's been used 2. On a T_CLASS/T_ICLASS, we track the T_CLASS/T_ICLASS which are the immediate children of the class. We use this for method invalidation, some cvar things, and to iterate through subclasses. Purpose 1 does not have any issues with box, the T_ICLASS always belongs to one specific module and that's immutable. This list can be box-global (always use the prime classext or hoist it out) and only needs to be pruned during free. If we care about behaviour under a particular box (ie. the propagating includes), we should look up the current box being modified on the ICLASS itself. Purpose 2 is more complicated. It currently tracks the immediate children, the T_CLASS or T_ICLASS whose super points back. Because super is per-box and is mutable (include/prepend insert ICLASSes into the chain) we need to update the list on include/prepend, entries must be per-box, and we can have multiple entries per-box. *I propose we simplify this by no longer tracking the immediate subclass*, but instead tracking the T_CLASS -> ... -> T_CLASS relationship, ie. the inverse of rb_class_superclass. That relationship is the same across all boxes and immutable after Class creation. As a special case the ICLASS for refinements are also added to the purpose 2 list (on T_CLASS). As those ICLASS do not chain to an eventual leaf T_CLASS. When we need to find the classes which have included a module, we can use the module subclasses list to find the ICLASS and then use RCLASS_INCLUDER. If we needed to iterate all T_ICLASS, we could then walk up the CLASS_SUPER chain, but I didn't find anywhere we needed to do that.
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