summaryrefslogtreecommitdiff
path: root/spec/ruby/core
AgeCommit message (Collapse)Author
2024-05-29merge revision(s) 6ade36c06b7cef948099b8f5f483763498705d12: [Backport #20414]Takashi Kokubun
`Fiber#raise` recursively raises on nested resuming_fiber. (#10482) * Improve consistency of `Fiber.current.raise`.
2024-03-21merge revision(s) ↵NARUSE, Yui
d19d683a354530a27b4cbb049223f8dc70c75849,de1a586ecc2ee7f465f0c0a69291054136a3a819: [Backport #20250] (#10308) rb_obj_setup: do not copy RUBY_FL_SEEN_OBJ_ID [Bug #20250] We're seting up a new instance, so it never had an associated object_id. proc.c: get rid of `CLONESETUP` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Bug #20253] All the way down to Ruby 1.9, `Proc`, `Method`, `UnboundMethod` and `Binding` always had their own specific clone and dup routine. This caused various discrepancies with how other objects behave on `dup` and `clone. [Bug #20250], [Bug #20253]. This commit get rid of `CLONESETUP` and use the the same codepath as all other types, so ensure consistency. NB: It's still not accepting the `freeze` keyword argument on `clone`. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
2023-12-25Typofix under bootstraptest, spec and yjit directoriesHiroshi SHIBATA
2023-12-07Fix keyword splat passing as regular argumentJeremy Evans
Since Ruby 3.0, Ruby has passed a keyword splat as a regular argument in the case of a call to a Ruby method where the method does not accept keyword arguments, if the method call does not contain an argument splat: ```ruby def self.f(obj) obj end def self.fs(*obj) obj[0] end h = {a: 1} f(**h).equal?(h) # Before: true; After: false fs(**h).equal?(h) # Before: true; After: false a = [] f(*a, **h).equal?(h) # Before and After: false fs(*a, **h).equal?(h) # Before and After: false ``` The fact that the behavior differs when passing an empty argument splat makes it obvious that something is not working the way it is intended. Ruby 2 always copied the keyword splat hash, and that is the expected behavior in Ruby 3. This bug is because of a missed check in setup_parameters_complex. If the keyword splat passed is not mutable, then it points to an existing object and not a new object, and therefore it must be copied. Now, there are 3 specs for the broken behavior of directly using the keyword splatted hash. Fix two specs and add a new version guard. Do not keep the specs for the broken behavior for earlier Ruby versions, in case this fix is backported. For the ruby2_keywords spec, just remove the related line, since that line is unrelated to what the spec is testing. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-11-29Do not call the inplicit convercion spec on older ruby versionsTema Bolshakov
2023-11-29Fix Array#rassoc specTema Bolshakov
2023-11-27Update to ruby/spec@c3206f6Benoit Daloze
2023-11-09IO#read always check the provided buffer is mutableJean Boussier
Otherwise you can have work in some circumstance but not in others.
2023-10-30Update to ruby/spec@bd7017fBenoit Daloze
2023-10-26Windows: Prefer USERPROFILE over HOMEPATHLars Kanis
Enable the test commented out in ruby/ruby@d0f5dc9eac78ecade459. Extracted from GH-7033, that is for initialization at start up time and this test is unrelated to it.
2023-10-12M:N thread scheduler for RactorsKoichi Sasada
This patch introduce M:N thread scheduler for Ractor system. In general, M:N thread scheduler employs N native threads (OS threads) to manage M user-level threads (Ruby threads in this case). On the Ruby interpreter, 1 native thread is provided for 1 Ractor and all Ruby threads are managed by the native thread. From Ruby 1.9, the interpreter uses 1:1 thread scheduler which means 1 Ruby thread has 1 native thread. M:N scheduler change this strategy. Because of compatibility issue (and stableness issue of the implementation) main Ractor doesn't use M:N scheduler on default. On the other words, threads on the main Ractor will be managed with 1:1 thread scheduler. There are additional settings by environment variables: `RUBY_MN_THREADS=1` enables M:N thread scheduler on the main ractor. Note that non-main ractors use the M:N scheduler without this configuration. With this configuration, single ractor applications run threads on M:1 thread scheduler (green threads, user-level threads). `RUBY_MAX_CPU=n` specifies maximum number of native threads for M:N scheduler (default: 8). This patch will be reverted soon if non-easy issues are found. [Bug #19842]
2023-10-03[DOC] State the precision of `Process.times` as platform-definedNobuyoshi Nakada
Remove the bad example that can lead to misunderstanding as if this precision is defined in Ruby.
2023-10-03Check by integer modulo instead of float stringNobuyoshi Nakada
2023-09-12Make Kernel#lambda raise when given non-literal blockAlan Wu
Previously, Kernel#lambda returned a non-lambda proc when given a non-literal block and issued a warning under the `:deprecated` category. With this change, Kernel#lambda will always return a lambda proc, if it returns without raising. Due to interactions with block passing optimizations, we previously had two separate code paths for detecting whether Kernel#lambda got a literal block. This change allows us to remove one path, the hack done with rb_control_frame_t::block_code introduced in 85a337f for supporting situations where Kernel#lambda returned a non-lambda proc. [Feature #19777] Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/8405
2023-09-04Update to ruby/spec@96d1072Benoit Daloze
2023-08-26[Bug #19784] Fix behaviors against prefix with broken encodingNobuyoshi Nakada
- String#start_with? - String#delete_prefix - String#delete_prefix! Notes: Merged: https://github.com/ruby/ruby/pull/8296
2023-08-24Fix support for dynamic keys. (#8273)Samuel Williams
* Skip RBS test. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-08-23Quarantine a very flaky specTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/5956398507/job/16157091112 This has been extremely flaky on macOS GitHub Actions. Benoit suggested to quarantine it if it's too problematic (it is) and there's no reasonable fix in a short time (it already took too long). So this commit follows the suggestion. We should remove revert this once rb_cloexec_open() is fixed.
2023-08-10Deprecate Kernel#open and IO support for subprocess creation/forkingMike Dalessio
Deprecate Kernel#open and IO support for subprocess creation and forking. This deprecates subprocess creation and forking in - Kernel#open - URI.open - IO.binread - IO.foreach - IO.readlines - IO.read - IO.write This behavior is slated to be removed in Ruby 4.0 [Feature #19630] Notes: Merged: https://github.com/ruby/ruby/pull/7915
2023-08-02Update to ruby/spec@9e278f5Benoit Daloze
2023-07-31`Refinement#refined_class` is now deprecatedNobuyoshi Nakada
2023-07-30Add examples of `return` in `eval`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8127
2023-07-26Make {Nil,True,False}Class#singleton_method always raise NameErrorJeremy Evans
{Nil,True,False}Class#singleton_methods always returns [] indicating that there are no singleton methods defined, so #singleton_method should be consistent with that. Fixes [Bug #11064] Notes: Merged: https://github.com/ruby/ruby/pull/7973
2023-07-24Use the caller location as default filename for eval family of methodsJean Boussier
[Feature #19755] Before (in /tmp/test.rb): ```ruby Object.class_eval("p __FILE__") # => "(eval)" ``` After: ```ruby Object.class_eval("p __FILE__") # => "(eval at /tmp/test.rb:1)" ``` This makes it much easier to track down generated code in case the author forgot to provide a filename argument. Notes: Merged: https://github.com/ruby/ruby/pull/8070
2023-07-17Implement Process.warmupJean Boussier
[Feature #18885] For now, the optimizations performed are: - Run a major GC - Compact the heap - Promote all surviving objects to oldgen Other optimizations may follow. Notes: Merged: https://github.com/ruby/ruby/pull/7662
2023-07-15[Bug #19769] Fix range of size 1 in `String#tr`alexandre184
Notes: Merged: https://github.com/ruby/ruby/pull/8080 Merged-By: nobu <nobu@ruby-lang.org>
2023-07-06Improve ArgumentError message for Module#set_temporary_nameBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/8035
2023-07-06Ensure the name given to Module#set_temporary_name is not a valid constant pathBenoit Daloze
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/8035
2023-07-06Specs for Module#set_temporary_name should be in their own fileBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/8035
2023-06-26Update to ruby/spec@30e1c35Benoit Daloze
2023-06-21Allow setting the name of a class or module. (#7483)Samuel Williams
Introduce `Module#set_temporary_name` for setting identifiers for otherwise anonymous modules/classes. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-29Refactor guards for Time.new specBenoit Daloze
2023-05-29Unify error messages of rb_num2ulong and rb_num2ullPeter Zhu
The error messages were slightly different due, which causes different behaviour on 32-bit and 64-bit systems. Notes: Merged: https://github.com/ruby/ruby/pull/7872
2023-05-29Update to ruby/spec@c3677cfBenoit Daloze
2023-05-24Add support for pread/pwrite on windows. (#7827)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-23Hash.new: print a deprecation warning when receiving keyword arguments (#7828)Jean byroot Boussier
[Feature #19236] In Ruby 3.3, `Hash.new` shall print a deprecation warning if keyword arguments are passed instead of treating them as an implicit positional Hash. This will allow to safely introduce a `capacity` keyword argument in 3.4 Co-authored-by: Jean Boussier <byroot@ruby-lang.org> Notes: Merged-By: byroot <byroot@ruby-lang.org>
2023-05-18Add Fiber#kill, similar to Thread#kill. (#7823)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-10[Bug #19597] Freeze script nameNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7709
2023-04-26marshal.c: shallow freeze user objectsJean Boussier
When `freeze: true` argument is passed. [Bug #19427] Notes: Merged: https://github.com/ruby/ruby/pull/7764
2023-04-25Update to ruby/spec@7f6ca5bBenoit Daloze
2023-04-25Workaround CRuby adding x86_64-linux-fake in $LOADED_FEATURESBenoit Daloze
2023-04-25Update to ruby/spec@7f69c86Benoit Daloze
2023-04-24Allow anonymous memberless StructJeremy Evans
Previously, named memberless Structs were allowed, but anonymous memberless Structs were not. Fixes [Bug #19416] Notes: Merged: https://github.com/ruby/ruby/pull/7587
2023-04-23Check the precision of `getrusage` at runtimeNobuyoshi Nakada
2023-04-22Fix a guard of `Process.times`Nobuyoshi Nakada
`GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID` clock uses `getrusage` always if available as the name states. That is if it is implemented `getrusage` is available, regardless microseconds in its results. Notes: Merged: https://github.com/ruby/ruby/pull/7739
2023-04-22Fix an example of `Process.times`Nobuyoshi Nakada
Prior to commit 5806c54447439f2ba22892e4045e78dd80f96f0c, it was "at least one result with precision beyond milliseconds (with none-zero microseconds) should exist"; after this commit, "at least one result should have zero microseconds". This chance is lower than the previous condition. Notes: Merged: https://github.com/ruby/ruby/pull/7739
2023-04-19MatchData#named_captures: add optional symbolize_names keyword (#6952)Vladimir Dementyev
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-04-17Add spec for `Warning[:performance]`Jean Boussier
[Feature #19538] Notes: Merged: https://github.com/ruby/ruby/pull/7715
2023-04-15Implement ObjectSpace::WeakMap#delete and ObjectSpace::WeakKeyMap#deleteJean Boussier
[Feature #19561] It's useful to be able to remove references from weak maps. Notes: Merged: https://github.com/ruby/ruby/pull/7629
2023-04-15* append newline at EOF. [ci skip]git