Граф коммитов

16290 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA bbe56a6437 Merge RubyGems/Bundler master
from bfb0ae6977
2022-12-12 10:49:43 +09:00
Takashi Kokubun 9d59d093bd
MJIT: Compile methods in batches (#6900)
* MJIT: Compile methods in batches

* MJIT: make mjit-bindgen

* MJIT: Fix RubyVM::MJIT tests
2022-12-10 22:21:06 -08:00
Mirek Klimos ea613c6360
Expose need_major_gc via GC.latest_gc_info (#6791) 2022-12-10 13:35:31 -05:00
Nobuyoshi Nakada fd440b09fc
A negative denominator case in the Rational string parsing test 2022-12-10 18:57:20 +09:00
Stan Lo 381e128c13 [ruby/irb] Fix step command (https://github.com/ruby/irb/pull/477)
The current `next` pre-command workaround on IRB source stepping
moves the location by 1 extra line. A better way is to make `debug`
skip IRB frames completely, which is what this commit does.

It also fixes the step command's test. The `|` in regexp was not escaped
so it was always incorrectly matched.
2022-12-09 23:39:17 +00:00
Maxime Chevalier-Boisvert daa893db41
YJIT: implement `getconstant` YARV instruction (#6884)
* YJIT: implement getconstant YARV instruction

* Constant id is not a pointer

* Stack operands must be read after jit_prepare_routine_call

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2022-12-09 14:12:15 -08:00
Matt Valentine-House 181d4bee5e Use rb_inspect instead of +PRIsVALUE for Object.inspect
In order to preserve the values when TrueClass, FalseClass or NilClass
are stored in ivars
2022-12-09 22:11:00 +09:00
Hiroshi SHIBATA 9557c8edf2 Merge net-protocol-0.2.1 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA d928ebacb2 Merge Psych-5.0.1 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA 286812bcf3 Merge fiddle-1.1.1 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA 4e31fea77d Merge strscan-3.0.5 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA bcf01b18cf Reapply the following commits related to extend timeout value.
66d1900423
  0686e4181d
  1a63468831
  e1fee7f949
  232e43fd52
2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA 643918ecfe Merge csv-3.2.6 2022-12-09 16:36:22 +09:00
Stan Lo c9076d546a [ruby/irb] Add show_doc as an alias to the help command
(https://github.com/ruby/irb/pull/475)

In the long-term, we want to align with `Pry`, `byebug` and `debug` to
use the `help` command to list all commands, which is what `show_cmds`
currently does. And `show_doc` will be the command to look up Ruby APIs.

By aliasing `show_doc` to the current `help` now, users will have time
to get use to it.
2022-12-08 21:46:55 +00:00
Stan Lo 12b7c129bf [ruby/irb] Gracefully handle missing command argument
(https://github.com/ruby/irb/pull/473)

* Handle file loading commands' argument error gracefully

Currently, if users don't provide an argument to `source`,
`irb_load`, and `irb_require`, IRB raises `ArgumentError` with full
stacktrace. This is confusing because it looks similar to when IRB has
internal issues. The message also isn't helpful on helping users avoid
the error.

So in this commit, I add a new `CommandArgumentError` for commands to
raise explicitly when users' input doesn't satisfy a command's argument
requirement.

* Gracefully handle `fg` command's argument requirement
2022-12-08 21:05:37 +00:00
Alan Wu bb8afd7265 Freeze singleton class, not its origin
Previously, when we froze an object, we froze
`RCLASS_ORIGIN(object.singleton_class)`, which didn't freeze
`object.singleton_class` when it has some prepended modules.

Origin iclass are internal objects and users can't interact with
them through Kernel#freeze?, Kernel#freeze, or any mutation method
that checks the frozen status. So we shouldn't touch the origin
iclasses when the frozen status should be visible.

[Bug #19169]
2022-12-08 15:58:26 -05:00
Stan Lo a87f802f1e [ruby/irb] Kill PTY process after test is finished
(https://github.com/ruby/irb/pull/471)

The killing/waiting logic is borrowed from ruby/debug:

ec5ae5aebd/test/support/test_case.rb (L107-L136)
2022-12-08 19:11:51 +00:00
Stan Lo 3956bb859c [ruby/irb] Add "show_cmds" command to list all commands'
descriptions
(https://github.com/ruby/irb/pull/463)

https://github.com/ruby/irb/commit/7e857655ac
2022-12-08 19:10:23 +00:00
Jean Boussier 73771e4b19 ObjectSpace.dump_all: dump shapes as well
I see several arguments in doing so.

First they use a non trivial amount of memory, so for various memory
profiling/mapping tools it is relevant to have visibility of the space
occupied by shapes.

Then, some pathological code can create a tons of shape, so it is
valuable to have a way to have a way to observe shapes without having
to compile Ruby with `SHAPE_DEBUG=1`.

And additionally it's likely much faster to dump then this way than
to use `RubyVM::Shape`.

There are however a few open questions:

- Shapes can't respect the `since:` argument. Not sure what to do when
  it is provided. Would probably make sense to not dump them.
- Maybe it would make more sense to have a separate `ObjectSpace.dump_shapes`?
- Maybe instead `dump_all` should take a `shapes: false` argument?

Additionally, `ObjectSpace.dump_shapes` is added for the use case of
debugging the evolution of the shape tree.
2022-12-08 18:46:16 +01:00
Nobuyoshi Nakada b19490f75d Use the built bundled gems in test-all as well as test-bundled-gems 2022-12-09 02:20:16 +09:00
Jean Boussier 6081fd4564 [ruby/net-protocol] Failing test case for #19
Unfortunately we have to use a mock, but this test demonstrate the
mutation bug fixed in #19.

It fails on 0.2.0 but passes on 0.1.3 or 0.2.1.

https://github.com/ruby/net-protocol/commit/40a1ab687c
2022-12-08 12:15:52 +00:00
Samuel Williams 6fd5d2dc00
Introduce `IO.new(..., path:)` and promote `File#path` to `IO#path`. (#6867) 2022-12-08 18:19:53 +13:00
Aaron Patterson edc7af48ac Stop transitioning to UNDEF when undefining an instance variable
Cases like this:

```ruby
obj = Object.new
loop do
  obj.instance_variable_set(:@foo, 1)
  obj.remove_instance_variable(:@foo)
end
```

can cause us to use many more shapes than we want (and even run out).
This commit changes the code such that when an instance variable is
removed, we'll walk up the shape tree, find the shape, then rebuild any
child nodes that happened to be below the "targetted for removal" IV.

This also requires moving any instance variables so that indexes derived
from the shape tree will work correctly.

Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com>
Co-authored-by: John Hawthorn <jhawthorn@github.com>
2022-12-07 09:57:11 -08:00
Ian Ker-Seymer 01fd1c482e [rubygems/rubygems] Remove remaining dev profile test
https://github.com/rubygems/rubygems/commit/7d50e998b3
2022-12-07 11:31:26 +00:00
Ian Ker-Seymer 88497b2167 [rubygems/rubygems] Better tests are better
https://github.com/rubygems/rubygems/commit/17abb80c2c
2022-12-07 11:31:25 +00:00
Ian Ker-Seymer ef50934721 [rubygems/rubygems] Fix string match in test
https://github.com/rubygems/rubygems/commit/82554f2bfd
2022-12-07 11:31:25 +00:00
Ian Ker-Seymer 554161236a [rubygems/rubygems] Always build in release mode
https://github.com/rubygems/rubygems/commit/7b84fc1f19
2022-12-07 11:31:25 +00:00
Ian Ker-Seymer 37d10caa0d [rubygems/rubygems] Updates rb-sys to 0.9.46
https://github.com/rubygems/rubygems/commit/6c2e7aafd6
2022-12-07 11:31:21 +00:00
Nobuyoshi Nakada 58cc3c9f38
[Bug #19187] Fix for tzdata-2022g 2022-12-07 19:19:54 +09:00
Martin Dürst ea532bd557 add file version check for new Unicode emoji file header
The change in the Unicode emoji file header took place at
version 14.0.0, but is needed only from version 15.0.0
because in version 14.0.0, another check is still active.
2022-12-06 10:11:33 +09:00
Stan Lo 9aa18f61f2 [ruby/irb] Allow disabling autocompletion with
`IRB_USE_AUTOCOMPLETE=false`
(https://github.com/ruby/irb/pull/469)

* Allow using IRB_USE_AUTOCOMPLETE=false to disable autocompletion

Currently, the only 2 ways to disable autocompletion are:

1. Create `.irbrc` and set `IRB.conf[:USE_AUTOCOMPLETE] = false`
2. Add the `--noautocomplete` flag when using the `irb` executable

Both of them are less convenient than setting a env var and are
lesser known to devs.

And given the number of problems the autocompletion has (see #445), I
think we should allow disabling it with a simple `IRB_USE_AUTOCOMPLETE=false`.

* Mention some env var configs in the README
2022-12-06 00:53:32 +00:00
Matthew Boeh 1602d75c34 [ruby/did_you_mean] Do not suggest #name= for #name and vice versa
(https://github.com/ruby/did_you_mean/pull/180)

* Do not suggest #name= for #name and vice versa
* Avoid allocating unnecessary MatchData

Co-authored-by: Jean byroot Boussier <jean.boussier+github@shopify.com>
Co-authored-by: Jean byroot Boussier <jean.boussier+github@shopify.com>
2022-12-05 13:16:33 +00:00
Nobuyoshi Nakada 74923aaf31 [ruby/irb] Close leaked pty IOs
https://github.com/ruby/irb/commit/cc9b1d7ba8
2022-12-05 12:03:57 +00:00
Stan Lo 16b2e03014 [ruby/reline] Remove unapproved color setting APIs
These APIs/configs are not approved by the Ruby core, so they can't be
released to the public. This means having them in the codebase will
block other fixes/features from being released as well.

So this commit removes those exposed interfaces to unblock the release.

Hopefully when https://bugs.ruby-lang.org/issues/18996 is approved we
can re-implement better APIs.

https://github.com/ruby/reline/commit/f7a961c550
2022-12-05 03:14:55 +00:00
Aaron Patterson dba61f487c return early if there is no is_entries buffer
If there is a compilation error, is_entries may not be allocated, but
ic_size could be greater than 0.  If we don't have a buffer to iterate
over, just return early.  Otherwise GC could segv

[Bug #19173]
2022-12-03 13:03:51 -06:00
Koichi Sasada 59e389af28 UnboundMethod only refer defined_class
UnboundMethod records caller's class, like `D` or `E` on the
following case:

```ruby
class C
  def foo = :foo
end

class D < C
end

class E < C
end

d = D.instance_method(:foo)
e = E.instance_method(:foo)
```

But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't
record `D` or `E`. This behavior changes the following methods:

* `UnboundMethod#inspect` (doesn't show caller's class)
* `UnboundMethod#==` (`d == e` for example)

fix https://bugs.ruby-lang.org/issues/18798
2022-12-03 08:53:12 +09:00
Stan Lo 7161bf34e1 [ruby/irb] Require pathname in test helper
(https://github.com/ruby/irb/pull/467)

https://github.com/ruby/irb/commit/39c6924c12
2022-12-02 22:00:42 +00:00
Stan Lo 69fd673b1a [ruby/irb] Disable debug cmd tests based on project structure
instead of env
(https://github.com/ruby/irb/pull/466)

It's hard to find an env var that's universally set in all Ruby CI
environments but not in local. Checking gemspec seems to be a better way
as `syntax_suggest` already uses it for a while.

d8f1bca297/spec/spec_helper.rb (L47)
2022-12-02 20:43:59 +00:00
Ellen Marie Dash 82b86b4c97 [rubygems/rubygems] Delete partial file and re-raise on Errno::ENOSPC.
Add test for not leaving empty files if ENOSPC is raised during 'gem install'

https://github.com/rubygems/rubygems/commit/8e0e20f079
2022-12-02 19:21:08 +00:00
Takashi Kokubun 5fafff15c6
Do not run drb SSL tests on Windows
These tests often cause a timeout and this issue seems specific to the
Windows platforms.
https://github.com/ruby/ruby/actions/runs/3603761925/jobs/6072346738
2022-12-02 10:49:56 -08:00
Nobuyoshi Nakada bb0ec7df32
Wait killed threads 2022-12-02 23:46:21 +09:00
Nobuyoshi Nakada 21ed929e15 [ruby/io-console] Omit on JRuby
https://github.com/ruby/io-console/commit/9122c181eb
2022-12-02 10:33:36 +00:00
Nobuyoshi Nakada 678bcfcaa6 [ruby/io-console] Check rawmode option names strictly
https://github.com/ruby/io-console/commit/aa8fc7e947
2022-12-02 10:33:35 +00:00
Takashi Kokubun f01bfa8af7 [ruby/irb] This doesn't work on RubyCI either
http://rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20221202T063302Z.fail.html.gz
http://rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20221202T053006Z.fail.html.gz
http://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20221202T063002Z.fail.html.gz
http://rubyci.s3.amazonaws.com/osx1013/ruby-master/log/20221202T054503Z.fail.html.gz

https://github.com/ruby/irb/commit/13c2484d59
2022-12-02 07:41:18 +00:00
Nobuyoshi Nakada ad4eab1a8c
Wait killed thread 2022-12-02 16:20:43 +09:00
Takashi Kokubun 7e3b42d008 [ruby/irb] Skip debug command tests on ruby/ruby
Stan has said these tests could be excluded if they don't work on
ruby/ruby CI.

https://github.com/ruby/irb/commit/11e779ecb7
2022-12-02 04:43:36 +00:00
Nobuyoshi Nakada b6c66ead9d [ruby/irb] Use the proper ruby command and library path
https://github.com/ruby/irb/commit/1416cc1871
2022-12-02 03:14:51 +00:00
Stan Lo 8abf9e6ad0 [ruby/irb] Test debug commands without yamatanooroti
(https://github.com/ruby/irb/pull/464)

* Add debug command tests that don't require yamatanooroti

* Remove debug command related yamatanooroti tests

As discussed in https://github.com/ruby/irb/pull/449#pullrequestreview-1187255149,
we should avoid adding new tests that need yamatanooroti because it's
not maintained by the Ruby org. And since debug commands are now tested
in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.

* Test against latest debug gem

https://github.com/ruby/irb/commit/78a8aa8834
2022-12-02 01:05:22 +00:00
Takashi Kokubun 8ffa8fc192
Relax the timeout of a YAML test
https://cirrus-ci.com/task/4752663775019008
2022-12-01 15:37:41 -08:00
Jean byroot Boussier 3d272b0fc8
Module#remove_method: Check frozen on the right object
Previously, the frozen check happened on `RCLASS_ORIGIN(self)`, which
can return an iclass. The frozen check is supposed to respond to objects
that users can call methods on while iclasses are hidden from users.
Other mutation methods like Module#{define_method,alias_method,public}
don't do this. Check frozen status on the module itself.

Fixes [Bug #19164] and [Bug #19166].

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2022-12-01 17:32:41 -05:00