Commit graph

18546 commits

Author SHA1 Message Date
Takashi Kokubun
c84237f953
Rewrite Array#each in Ruby using Primitive (#9533) 2024-01-23 20:09:57 +00:00
Peter Zhu
b14674b236 Memory leak with TracePoint on bmethod
[Bug #20194]

When disabling the TracePoint on bmethod, the hooks list is not freed.

For example:

    obj = Object.new
    obj.define_singleton_method(:foo) {}
    bmethod = obj.method(:foo)
    tp = TracePoint.new(:return) {}

    10.times do
      100_000.times do
        tp.enable(target: bmethod) {}
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    18208
    22832
    26528
    29728
    34000
    37776
    40864
    44400
    47680
    51504

After:

    16688
    17168
    17168
    17248
    17696
    17760
    17824
    17824
    17856
    17920
2024-01-23 10:47:04 -05:00
Aaron Patterson
cfa15bb173 Handle trailing commas on blocks
We need to set a special flag on block iseqs when there is a trailing
comma.

Fixes: https://github.com/ruby/prism/issues/2244
2024-01-22 16:35:58 -08:00
dependabot[bot]
6fb9dc5089 [rubygems/rubygems] Bump shlex
Bumps [shlex](https://github.com/comex/rust-shlex) from 1.1.0 to 1.3.0.
- [Changelog](https://github.com/comex/rust-shlex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/comex/rust-shlex/commits)

---
updated-dependencies:
- dependency-name: shlex
  dependency-type: indirect
...

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

ca4efb9e9d
2024-01-23 00:33:48 +00:00
dependabot[bot]
cb8235c9c9 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.86 to 0.9.87.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.86...v0.9.87)

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

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

40292944e8
2024-01-23 00:33:39 +00:00
dependabot[bot]
7811dd169b [rubygems/rubygems] Bump shlex
Bumps [shlex](https://github.com/comex/rust-shlex) from 1.1.0 to 1.3.0.
- [Changelog](https://github.com/comex/rust-shlex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/comex/rust-shlex/commits)

---
updated-dependencies:
- dependency-name: shlex
  dependency-type: indirect
...

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

70812aeeb1
2024-01-23 00:33:28 +00:00
Aaron Patterson
270a46e392 Check keyword parameters correctly
We weren't checking the right offsets when compiling methods with
keyword parameters that had complex code.

Fixes: https://github.com/ruby/prism/issues/2228
2024-01-22 16:02:41 -08:00
Hiroshi SHIBATA
706eea9d3c
Fixup 2e69137dbe 2024-01-23 08:45:45 +09:00
Peter Zhu
708fa77404 [PRISM] Fix keyword arguments in IndexOrWriteNode
Fixes ruby/prism#2236.
2024-01-22 15:07:52 -08:00
Peter Zhu
1838dbf6e7 [PRISM] Fix splat and block in aset 2024-01-22 15:07:39 -08:00
Peter Zhu
1847192366 [PRISM] Fix block in aset
Fixes ruby/prism#2223.
2024-01-22 15:07:39 -08:00
Takashi Kokubun
28fc7fa852 Revert "Bump shlex"
This reverts commit dcabe87fc8.

Revert "Bump shlex"

This reverts commit 47264b78c2.

Avoid diversion in gem sync. They should be managed in rubygems/rubygems
and then sync-ed to ruby/ruby.
2024-01-22 14:35:16 -08:00
dependabot[bot]
dcabe87fc8 Bump shlex
Bumps [shlex](https://github.com/comex/rust-shlex) from 1.1.0 to 1.3.0.
- [Changelog](https://github.com/comex/rust-shlex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/comex/rust-shlex/commits)

---
updated-dependencies:
- dependency-name: shlex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-22 14:16:10 -08:00
dependabot[bot]
47264b78c2 Bump shlex
Bumps [shlex](https://github.com/comex/rust-shlex) from 1.1.0 to 1.3.0.
- [Changelog](https://github.com/comex/rust-shlex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/comex/rust-shlex/commits)

---
updated-dependencies:
- dependency-name: shlex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-22 14:10:39 -08:00
Aaron Patterson
7db6832225 Fix compiling rescue + ensure
When we're compiling begin / rescue / ensure nodes, we need to "wrap"
the code in the begin statements correctly.  The wrapping is like this:
(ensure code (rescue code (begin code)))

This patch pulls the each leg in to its own function, then calls the
appropriate wrapping function depending on whether there are ensure /
rescue legs.

Fixes: https://github.com/ruby/prism/issues/2221
2024-01-22 12:02:03 -08:00
dependabot[bot]
1236cad92d [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.86 to 0.9.87.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.86...v0.9.87)

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

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

d86482f0b0
2024-01-22 18:58:59 +00:00
Peter Zhu
dbd76d9101 [PRISM] Fix keyword splat in IndexAndWriteNode and IndexOrWriteNode
Fixes ruby/prism#2232 and ruby/prism#2234.
2024-01-22 12:56:43 -05:00
Peter Zhu
a7af34fa8b [PRISM] Fix keywords arguments in IndexAndWriteNode
Fixes ruby/prism#2233.
2024-01-22 11:26:21 -05:00
Kevin Newton
eb5797062a [ruby/prism] Reference prism after require
0a8ff431df
2024-01-22 16:16:33 +00:00
Kevin Newton
e00f42e5d3 [ruby/prism] Return 1-indexed line numbers
ad17f58729
2024-01-22 16:13:36 +00:00
Peter Zhu
580429d27c [PRISM] Fix incorrect ordering of MultiTargetNode
Fixes ruby/prism#2218.
2024-01-22 10:51:43 -05:00
Matt Valentine-House
b8495048fb [ruby/prism] Unescape method name for unary methods.
4386a4c0da
2024-01-22 13:19:57 +00:00
Hiroshi SHIBATA
2e69137dbe Use version dependant library for completion test 2024-01-22 18:23:05 +09:00
Hiroshi SHIBATA
e195710d10 Extract csv 2024-01-22 18:23:05 +09:00
Hiroshi SHIBATA
029b6d5b76 Extract syslog 2024-01-22 15:59:40 +09:00
Hiroshi SHIBATA
38a1b88d1e Skip nkf from check_existence 2024-01-22 14:17:52 +09:00
Hiroshi SHIBATA
df70faa9c9 Extract nkf 2024-01-22 14:17:52 +09:00
Hiroshi SHIBATA
36fc5ee64f Extract drb 2024-01-22 11:08:59 +09:00
Stan Hu
67b00f721d Make tests play with upstream Ruby tests
CI broke in https://github.com/ruby/ruby/pull/9604 because if any Ruby
tests run `require 'net/http'`, they will pollute the
`$LOADED_FEATURES` for the RubyGems tests. We can fix this by renaming
the test default gem from `net-http` to `my-http`.

See https://github.com/rubygems/rubygems/pull/7379#issuecomment-1901241299
for more details.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
00dc1cace8 Reapply "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit 04cf66765a.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
d51f4c9288 Reapply "[rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it"
This reverts commit 54552b89e7.
2024-01-22 09:57:10 +09:00
BurdetteLamar
366b14c0cd More tests 2024-01-20 10:27:19 -05:00
Adam Hess
cfabe9c51c [ruby/prism] Handle stovetop start in constant path fullname
3a216e63fe
2024-01-19 22:57:45 +00:00
eileencodes
ed50161bd6 [PRISM] Fix ensure code running twice
Fixes: ruby/prism#2212
2024-01-19 13:04:01 -08:00
Aaron Patterson
4778b0eeda Fix kwarg ordering
Required keyword arguments need to come first.

Fixes: https://github.com/ruby/prism/issues/2158

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-01-19 12:32:20 -08:00
Aaron Patterson
efe4b8ac0f Fix ensure code when running break in a while loop
We need to run ensure code when breaking from a while loop

Co-authored-by: John Hawthorn <jhawthorn@github.com>
Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-01-19 09:35:36 -08:00
Hiroshi SHIBATA
411cda2d5c Extract rinda 2024-01-19 20:02:19 +09:00
Hiroshi SHIBATA
b4ee5266f1 Extract abbrev as bundled gems 2024-01-19 16:27:45 +09:00
Hiroshi SHIBATA
176a442883 Extract observer as bundled gems 2024-01-19 15:24:09 +09:00
Hiroshi SHIBATA
54552b89e7
Revert "[rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it"
This reverts commit f1f5f22d22.
2024-01-19 12:12:33 +09:00
Hiroshi SHIBATA
04cf66765a
Revert "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit db44088c2a.

  2064164082
  2064164121
  2064164203
2024-01-19 11:54:17 +09:00
David Rodríguez
db44088c2a [rubygems/rubygems] Fix activation conflicts when circularly requiring a gem
If a gem is required circular, and there are unresolved specs depending
on it, we may end up in an activation conflict.

The solution is to not try to activate unresolved gems when requiring a
default gem, regardless of it having already been activated or not.

3b2b8f4e3e
2024-01-19 11:28:11 +09:00
David Rodríguez
f1f5f22d22 [rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it
The following conditions must be met:

* A default gem is required.
* A previous require left some gems unresolved, and those dependencies
  themselves depend on the default gem.

In this case, rubygems require will first activate the default version
of the gem, then try to activate another unresolved version of the
default gem that conflicts with the first activation.

The solution is, if we are in the middle of requiring a default gem,
skip this step, because we have already activated it successfully.

8cd5608db5

Co-authored-by: Stan Hu <stanhu@gmail.com>
2024-01-19 11:28:11 +09:00
NAITOH Jun
91f3530580
[ruby/strscan] Add test to check encoding for empty string
(https://github.com/ruby/strscan/pull/80)

See: https://github.com/ruby/strscan/issues/78#issuecomment-1890849891

d0508518a9
2024-01-19 10:49:12 +09:00
David Rodríguez
4e47671073
[rubygems/rubygems] Test that regular gems don't shadow default gems
b8ca5950a6
2024-01-19 10:49:12 +09:00
Matt Valentine-House
8a3e7f08b8 [PRISM] Fix case splat with no predicate 2024-01-18 20:03:27 +00:00
Robert Schulze
d3b07b9845 [ruby/psych] Add :stringify_names option to convert symbol keys to string for dumping
3d051d89aa
2024-01-18 17:32:34 +00:00
tomoya ishida
fd1bafc11f [ruby/stringio] Fix ascii_only? flag in strio_write
(https://github.com/ruby/stringio/pull/77)

Followup of #79

`rb_str_resize()` was changed by b0b9f7201a  .

```c
rb_str_resize(string, shorter) // clear ENC_CODERANGE in some case
rb_str_resize(string, longer) // does not clear ENC_CODERANGE anymore
```

```c
// rb_str_resize in string.c
if (slen > len && ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
  ENC_CODERANGE_CLEAR(str);
}
```

I think this change is based on an assumption that appending null bytes
will not change flag `ascii_only?`.

`strio_extend()` will make the string longer if needed, and update the
flags correctly for appending null bytes.
Before `memmove()`, we need to `rb_str_modify()` because updated flags are not
updated for `memmove()`.

b31a538576
2024-01-18 03:42:21 +00:00
Hiroshi SHIBATA
9f729cf36a Skip bigdecimal extension on TestExtLibs 2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA
2b0766113b Extract bigdecimal as bundled gems 2024-01-18 07:44:13 +09:00