Commit graph

16692 commits

Author SHA1 Message Date
Peter Zhu
0264424d58 Add test for GC thrashing of young object creation
This test will prevent performance regressions like [Bug #18929].
2022-08-15 10:00:03 -04:00
Jeremy Evans
89aa09afaf [ruby/rinda] Handle situations where IPv4 multicast is not available
Fixes [Bug #13864]

3cd620f38c
2022-08-15 14:11:52 +09:00
Nobuyoshi Nakada
844a0edbae [Bug #18962] Do not read again once reached EOF
`Ripper::Lexer#parse` re-parses the source code with syntax errors
when `raise_errors: false`.

Co-Authored-By: tompng <tomoyapenguin@gmail.com>
2022-08-12 15:58:18 +09:00
Kouhei Yanagita
24e33b84b5 Remove Numeric#ceildiv 2022-08-12 15:57:52 +09:00
Kouhei Yanagita
4165fd0e76 Add Numeric#ceildiv and Integer#ceildiv 2022-08-12 15:57:52 +09:00
Nobuyoshi Nakada
cd1a0b3caa Stop defining RUBY_ABI_VERSION if released versions
As commented in include/ruby/internal/abi.h, since teeny versions of
Ruby should guarantee ABI compatibility, `RUBY_ABI_VERSION` has no role
in released versions of Ruby.
2022-08-12 15:57:25 +09:00
Jeremy Evans
49517b3bb4 Fix inspect for unicode codepoint 0x85
This is an inelegant hack, by manually checking for this specific
code point in rb_str_inspect.  Some testing indicates that this is
the only code point affected.

It's possible a better fix would be inside of lower-level encoding
code, such that rb_enc_isprint would return false and not true for
codepoint 0x85.

Fixes [Bug #16842]
2022-08-11 08:47:29 -07:00
Jeremy Evans
cfb9624460
Fix Array#[] with ArithmeticSequence with negative steps (#5739)
* Fix Array#[] with ArithmeticSequence with negative steps

Previously, Array#[] when called with an ArithmeticSequence
with a negative step did not handle all cases correctly,
especially cases involving infinite ranges, inverted ranges,
and/or exclusive ends.

Fixes [Bug #18247]

* Add Array#slice tests for ArithmeticSequence with negative step to test_array

Add tests of rb_arithmetic_sequence_beg_len_step C-API function.

* Fix ext/-test-/arith_seq/beg_len_step/depend

* Rename local variables

* Fix a variable name

Co-authored-by: Kenta Murata <3959+mrkn@users.noreply.github.com>
2022-08-11 19:16:49 +09:00
Jeremy Evans
ff42e2359b Revert "Add {Method,UnboundMethod}#{public?,private?,protected?}"
This reverts commit 2727815068 and
58dc8bf8f1.

Visibility is an attribute of the method entry in a class, not an
attribute of the Method object.

Fixes [#18729]
Fixes [#18751]
Fixes [#18435]
2022-08-10 13:02:52 -07:00
Yusuke Endoh
3a58009066 [ruby/error_highlight] Make backtrace_location keyword work
We had to keep backtrace_location before opts is overwritten.

2735e4681a
2022-08-10 21:19:10 +09:00
Yusuke Endoh
99e7fa5b37 [ruby/error_highlight] Make ErrorHighlight.spot accept Exception (https://github.com/ruby/error_highlight/pull/25)
... and move things from core_ext.rb to base.rb.
This will confine CRuby-dependent things to ErrorHighlight.spot.

22d1dd7824
2022-08-10 18:37:13 +09:00
Hiroshi SHIBATA
44264b4fee Merge rubygems/bundler HEAD.
Pick from dfbb5a3811
2022-08-09 12:05:19 +09:00
dependabot[bot]
35b9cd1def [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.28 to 0.9.29.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.28...v0.9.29)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

77a945f0e8
2022-08-09 04:35:33 +09:00
Nobuyoshi Nakada
79fdf9712d
Tentatively exclude the test that triggers ruby/psych#572 2022-08-09 03:09:33 +09:00
dependabot[bot]
78bc2aae7f [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.28 to 0.9.29.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.28...v0.9.29)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

d5d96f6bae
2022-08-09 01:50:18 +09:00
Alexander Momchilov
9c13a6ce5f [ruby/psych] Raise specific error when an anchor isn't defined
98fbd5247a
2022-08-09 01:33:34 +09:00
Alexander Momchilov
4b9cdf4e1c [ruby/psych] Update to squiggly heredocs in the file
42b43de997
2022-08-09 01:33:33 +09:00
Alexander Momchilov
38ea6b30dc [ruby/psych] Add test for missing anchor
5f08137ae6
2022-08-09 01:33:32 +09:00
Alexander Momchilov
ea1efdf32f [ruby/psych] Add test for anchor reuse
The spec calls this a "reuse" of an anchor
https://yaml.org/spec/1.2.2/#71-alias-nodes

57e3b70a56
2022-08-09 01:33:31 +09:00
Alexander Momchilov
54219ae8c4 [ruby/psych] Raise specific error when aliases are not enabled
0c11ddcf46
2022-08-09 01:32:47 +09:00
Alexander Momchilov
71f89c2874 [ruby/psych] Don't hardcode expected alias names
b9ab19094f
2022-08-09 01:31:24 +09:00
Alexander Momchilov
0b7cfdca09 [ruby/psych] Test that recursive refs dump as aliases
d9f7289190
2022-08-09 01:31:23 +09:00
Alexander Momchilov
c851bced39 [ruby/psych] Clarify tests about parsing aliases
0bc30cb4cb
2022-08-09 01:31:22 +09:00
Nobuyoshi Nakada
e07d450dea [ruby/date] Fix Time#to_datetime before calendar reform
Time is always in the proleptic Gregorian calendar.
Also DateTime#to_time should convert to the Gregorian calendar first,
before extracting its components.

https://bugs.ruby-lang.org/issues/18946#change-98527

b2aee75248
2022-08-08 23:50:17 +09:00
Nobuyoshi Nakada
5beb75ce8d
[ruby/rdoc] Allow multiple footnotes without in-between blank lines
e4e054e3ce used four footnotes
without blank lines.  And the ChangeLog generated from that commit
resulted in ``undefined method `parts' for nil`` error.

For now, let a footnote terminated by the next footnote mark.

Also refined the error message when undefined footnote is used.

a7f290130b
2022-08-08 01:12:49 +09:00
David Rodríguez
f310ac1cb2 [rubygems/rubygems] Include backtrace with crashes by default
3cc3bfd371
2022-08-05 16:37:03 +09:00
John Hawthorn
70b60d24b9 Fix inconsistency with opt_aref_with
opt_aref_with is an optimized instruction for accessing a Hash using a
non-frozen string key (ie. from a file without frozen_string_literal).
It attempts to avoid allocating the string, and instead silently using a
frozen string (hash string keys are always fstrings).

Because this is just an optimization, it should be invisible to the
user. However, previously this optimization was could be seen via hashes
with default procs.

For example, previously:

    h = Hash.new { |h, k| k.frozen? }
    str = "foo"
    h[str]   # false
    h["foo"] # true when optimizations enabled

This commit checks that the Hash doesn't have a default proc when using
opt_aref_with.
2022-08-04 14:48:47 -07:00
David Rodríguez
c84d0538be [rubygems/rubygems] Fix unused variable warning
```
/Users/deivid/Code/rubygems/rubygems/test/rubygems/test_gem_resolver_installer_set.rb:55: warning: assigned but unused variable - a_1_local
```

9ea4534800
2022-08-05 00:09:18 +09:00
David Rodríguez
542040fb83 [rubygems/rubygems] Warn dangling symlinks
425b78637f
2022-08-04 13:36:45 +09:00
Jean Boussier
4406cb1bf1 Harden Queue#pop timeout tests
They occasionaly fail with;

```
  FLeaked thread: TestThreadQueue#test_queue_pop_timeout: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep>
  .Finished thread: TestThreadQueue#test_deny_pushers: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 dead>
  ...
  Retrying...

    1) Failure:
  TestThreadQueue#test_sized_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:157]:
  <#<Thread:0x00000001084bc7e8 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:156 sleep>> expected but was
  <nil>.

    2) Failure:
  TestThreadQueue#test_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:124]:
  <#<Thread:0x00000001083ff058 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep>> expected but was
  <nil>.
```

I'm hoping joining for longer should help avoid this.
2022-08-03 10:59:13 +02:00
Hiroshi SHIBATA
71794a75db Merge rubygems/bundler HEAD
Pick from 8331e63263
2022-08-03 13:14:10 +09:00
Ilya Dyakonov
4f00ee8d47 [rubygems/rubygems] fix platform matching for index specs
f087f1b590
2022-08-03 06:56:36 +09:00
David Rodríguez
20936eb3a9 [rubygems/rubygems] Warn (rather than crash) when setting nil specification versions
a4ba1a4d97
2022-08-03 06:56:18 +09:00
Jean Boussier
e3aabe93aa Implement Queue#pop(timeout: sec)
[Feature #18774]

As well as `SizedQueue#pop(timeout: sec)`

If both `non_block=true` and `timeout:` are supplied, ArgumentError
is raised.
2022-08-02 11:04:28 +02:00
Nobuyoshi Nakada
ec3f59309e [Bug #17767] Now ENV.clone raises TypeError as well as ENV.dup
One year ago, the former method has been deprecated while the latter
has become an error.  Then the 3.1 released, it is enough time to make
also the former an error.
2022-08-02 16:40:12 +09:00
dependabot[bot]
24204d54ab [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.26 to 0.9.28.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.26...v0.9.28)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

edea8fbfa0
2022-08-02 04:14:48 +09:00
dependabot[bot]
25022bad85 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.26 to 0.9.28.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.26...v0.9.28)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

831a001697
2022-08-02 02:37:55 +09:00
Koichi Sasada
5bbba76489 respect current frame of rb_eval_string
`self` is nearest Ruby method's `self`.
If there is no ruby frame, use toplevel `self` (`main`).

https://bugs.ruby-lang.org/issues/18780
2022-08-01 17:48:05 +09:00
Akinori MUSHA
1a73a6cdd2
Implement Enumerator::Product and Enumerator.product [Feature #18685] 2022-07-30 20:05:14 +09:00
Nobuyoshi Nakada
af265d73fb [ruby/rdoc] Fix blockquote with word in verbatim
75eee668a5
2022-07-30 11:04:11 +09:00
Ethan
b2cc74a50d [flori/json] test parsing of unicode, mixing literal characters with escaped
82fe866da2
2022-07-29 19:10:10 +09:00
konsolebox
419ad1e13e [ruby/optparse] Also accept '-' as an optional argument (https://github.com/ruby/optparse/pull/35)
f2b8318631
2022-07-29 19:10:10 +09:00
Nobuyoshi Nakada
f29f1d22c3 [ruby/rdoc] Fix formatting blockquote in verbatim
Reported at https://github.com/ruby/rdoc/pull/907#discussion_r932505816

86384ac7f9
2022-07-29 09:21:33 +09:00
Takashi Kokubun
0d68286be9
Revert "Try reproducing the MinGW hang on time command (#6168)"
This reverts commit bee5089d67.

Looking at 7564065637,
we concluded that the ruby process for test-all is stuck before exit
when this issue reproduces.

However, because of our limited bandwidth to support MinGW, we're not
investigating this, and therefore we need to keep skipping tests that
hang on this environment.
2022-07-28 16:12:46 -07:00
Matthew Draper
ab08a43ec5
YJIT: Teach getblockparamproxy to handle the no-block case without exiting (#6191)
Teach getblockparamproxy to handle the no-block case without exiting

Co-authored-by: John Hawthorn <john@hawthorn.email>

Co-authored-by: John Hawthorn <john@hawthorn.email>
2022-07-28 11:38:07 -04:00
Hiroshi SHIBATA
3eade59919
Skip randomly failing tests with FreeBSD 12 2022-07-28 19:45:15 +09:00
Hiroshi SHIBATA
d448ecc7b1
Fix the missing brackets 2022-07-28 19:25:52 +09:00
Hiroshi SHIBATA
202ce7de01
test_io_console.rbL399 is also randomly failing same as bfc697f1e2 2022-07-28 19:14:01 +09:00
Takashi Kokubun
bee5089d67
Try reproducing the MinGW hang on time command (#6168)
to see if it really exits correctly. 

GitHub Support asked me to confirm the command is exiting correctly.
2022-07-27 21:29:14 -07:00
Ivo Anjo
649bfbe00d Fix rb_profile_frames output includes dummy main thread frame
The `rb_profile_frames` API did not skip the two dummy frames that
each thread has at its beginning. This was unlike `backtrace_each` and
`rb_ec_parcial_backtrace_object`, which do skip them.

This does not seem to be a problem for non-main thread frames,
because both `VM_FRAME_RUBYFRAME_P(cfp)` and
`rb_vm_frame_method_entry(cfp)` are NULL for them.

BUT, on the main thread `VM_FRAME_RUBYFRAME_P(cfp)` was true
and thus the dummy thread was still included in the output of
`rb_profile_frames`.

I've now made `rb_profile_frames` skip this extra frame (like
`backtrace_each` and friends), as well as add a test that asserts
the size and contents of `rb_profile_frames`.

Fixes [Bug #18907] (<https://bugs.ruby-lang.org/issues/18907>)
2022-07-26 10:43:44 +09:00