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

70826 Коммитов

Автор SHA1 Сообщение Дата
Jeremy Evans a79c59472d Allow include before calling Module#initialize
This is to allow Module subclasses that include modules before
calling super in the subclass's initialize.

Remove rb_module_check_initializable from Module#initialize.
Module#initialize only calls module_exec if a block is passed,
it doesn't have other issues that would cause problems if
called multiple times or with an already initialized module.

Move initialization of super to Module#allocate, though I'm not
sure it is required there.  However, it's needed to be removed
from Module#initialize for this to work.

Fixes [Bug #18292]
2022-01-06 08:03:33 -08:00
ximenasandoval 73be7a85cd [rubygems/rubygems] Fix suggestions flag
https://github.com/rubygems/rubygems/commit/b55a1393ca
2022-01-06 23:58:39 +09:00
ximenasandoval cea4a81056 [rubygems/rubygems] Let fetch understand gem:version syntax
Fix version error message

Add tests to fetch error messages

Fix default version since is not necessary

https://github.com/rubygems/rubygems/commit/070620ebe4
2022-01-06 23:58:38 +09:00
David Rodríguez ee5e684bc1 [rubygems/rubygems] Fix `gem install <non-existent-gem> --force` crash
Before:

```
$ gem install sfdsfdsfsdide --force
ERROR:  While executing gem ... (NoMethodError)
    undefined method `spec' for nil:NilClass

    @always_install << newest.spec
                             ^^^^^
```

After:

```
$ gem install sfdsfdsfsdide --force
ERROR:  Could not find a valid gem 'sfdsfdsfsdide' (>= 0) in any repository
```

https://github.com/rubygems/rubygems/commit/4e2bfd1101
2022-01-06 23:52:48 +09:00
YO4 e3b0c8c106 [ruby/reline] windows: test_yamatanooroti fix
windows can't create too narrow and tall window.

https://github.com/ruby/reline/commit/20b5f2f6fc
2022-01-06 18:33:57 +09:00
Yuta Saito e554b17c60 tool/rbinstall.rb: instal ruby.wasm produced by Emscripten 2022-01-06 18:14:24 +09:00
git 2db7952e59 Update bundled gems list at 2022-01-06 2022-01-06 07:02:37 +00:00
Nobuyoshi Nakada 3e417a554b
NEWS: "taintedness" and "trustedness" methods are removed 2022-01-06 11:32:27 +09:00
Nobuyoshi Nakada ac0d27eb58
NEWS: Separate removed constants section 2022-01-06 11:20:55 +09:00
Nobuyoshi Nakada da43c8822c
Remove useless code [Bug #18185]
RMODULE_SUPER is initialized to 0, as the uninitialized module
flag is used since b929af430c.
2022-01-06 10:26:19 +09:00
Kazuhiro NISHIYAMA 5e7cd480f9
Fix spec failure on ruby 3.1
Because https://github.com/ruby/ruby/pull/5148 merged after Ruby 3.1.0 released.

13241b71a5 did not fix proc spec yet.

https://github.com/ruby/actions/runs/4718820699?check_suite_focus=true#step:18:173
```
  1)
  Proc#parameters adds * rest arg for "star" argument FAILED
  Expected [[:req, :x], [:rest]] == [[:req, :x], [:rest, :*]]
  to be truthy but was false
  /home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/proc/parameters_spec.rb:85:in `block (3 levels) in <top (required)>'
  /home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/proc/parameters_spec.rb:3:in `<top (required)>'
```
2022-01-06 10:14:11 +09:00
Burdette Lamar 445c055b44
Enhanced RDoc for IO (#5395)
Treats:

    #getc
    #readchar
    #getbyte
    #readbyte
    #ungetbyte
2022-01-05 16:13:06 -06:00
git 7bef101eaa * 2022-01-06 [ci skip] 2022-01-06 03:59:19 +09:00
Jeremy Evans 791343b5bb Remove Refinement#{extend_object,append_features,prepend_features}
Also make include, prepend, and extend raise a TypeError if one
of the modules is a refinement.

Implements [Feature #18270]
2022-01-05 10:59:03 -08:00
Yusuke Endoh f22296d27e test/ruby/test_refinement.rb: Remove "assigned but unused variable" 2022-01-05 23:46:27 +09:00
Peter Zhu 6f7e02bf46 Remove assertion causing read barrier to trigger
GET_HEAP_PAGE reads the page. If during compaction there is a read
barrier on the page, it causes the read barrier to trigger.
2022-01-05 09:32:53 -05:00
Hiroshi SHIBATA 8bba6d3d54 [rubygems/rubygems] Exclude bin directory for newgem template, Because it contains only development script
https://github.com/rubygems/rubygems/commit/01017ee8ca
2022-01-05 19:16:53 +09:00
Nobuyoshi Nakada e38d583391
NEWS: Links to the tickets to remove deprecated features 2022-01-05 18:27:16 +09:00
Nobuyoshi Nakada 1272a331b4
NEWS: Removal of `Kernel#=~` [Feature #15231] 2022-01-05 18:18:43 +09:00
Shugo Maeda 54198c7b97
Add Module#refinements and Refinement#refined_class [Feature #12737] 2022-01-05 17:47:29 +09:00
Shugo Maeda 21ee5341f8
Add Module.used_refinements 2022-01-05 16:58:23 +09:00
Kazuhiro NISHIYAMA 5757696e07
`res.response_body_permitted?` is not defined
`response_body_permitted?` is a method of request.
2022-01-05 16:20:11 +09:00
Burdette Lamar 6326112e16
Enhanced RDoc for Enumerable (#5393)
A little more about the classes that include or extend Enumerable.
2022-01-04 18:39:07 -06:00
Kazuhiro NISHIYAMA d5836db1b3
Fix `Leaked file descriptor: TestIO_Console#test_console_kw`
```
Leaked file descriptor: TestIO_Console#test_console_kw: 10 : #<File:/dev/tty>
```
2022-01-05 09:05:52 +09:00
Kazuhiro NISHIYAMA 13241b71a5
Fix failures on ruby 3.1
Because https://github.com/ruby/ruby/pull/5148 merged after Ruby 3.1.0 released.

https://github.com/ruby/actions/runs/4705986643?check_suite_focus=true#step:18:144
```
  1)
  Method#parameters adds * rest arg for "star" argument FAILED
  Expected [[:rest]] == [[:rest, :*]]
  to be truthy but was false
  /home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/method/parameters_spec.rb:228:in `block (3 levels) in <top (required)>'
  /home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/method/parameters_spec.rb:4:in `<top (required)>'

  2)
  Proc#parameters adds * rest arg for "star" argument FAILED
  Expected [[:req, :x], [:rest]] == [[:req, :x], [:rest, :*]]
  to be truthy but was false
  /home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/proc/parameters_spec.rb:85:in `block (3 levels) in <top (required)>'
  /home/runner/work/actions/actions/snapshot-ruby_3_1/spec/ruby/core/proc/parameters_spec.rb:3:in `<top (required)>'
```
2022-01-05 08:18:47 +09:00
David Rodríguez d1a91076dc [rubygems/rubygems] Fix race conditon on JRuby
On JRuby, sometimes we get the following error in CI when running a
realworld test that checks that `gem install rails` succeeds:

```
ERROR:  While executing gem ... (NoMethodError)
    undefined method `ignored=' for nil:NilClass
	/home/runner/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/stub_specification.rb:193:in `to_spec'
	org/jruby/RubyArray.java:2642:in `map'
	/home/runner/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/specification.rb:758:in `_all'
	/home/runner/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/specification.rb:956:in `each'
	org/jruby/RubyEnumerable.java:1710:in `any?'
	/home/runner/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:111:in `installed?'
	/home/runner/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/request_set.rb:173:in `block in install'
```

I'm not sure how this error is happening, but I think there's no need to
copy the `@ignored` instance variable when materializing stub
specifications. This instance variable is used to not print a warning
about missing extensions more than once for each gem upon gem
activation, but as far as I can see, it's only used by methods that work
on specification stubs. Once specifications are materialized, I think
it can be safely ignored.

https://github.com/rubygems/rubygems/commit/301cecd5a7
2022-01-05 07:25:45 +09:00
Jeremy Evans 5917f49ad0 Fix documentation for Dir.glob
Dir.glob("*", File::FNM_DOTMATCH) no longer includes ".." in the
returned array as of Ruby 3.1.

Fixes [Bug #18436]
2022-01-04 12:38:50 -08:00
Peter Zhu 44379805b0 Fix crash on bootup when RGENGC_CHECK_MODE=2 with GC stress
We need to unshare the array loaded_features because the shared root
could be old gen (while loaded_features is young) which causes a WB
miss.
2022-01-04 14:46:20 -05:00
Burdette Lamar 9c15da0fd4
Enhanced RDoc for IO (#5381)
Treats:

    #lineno
    #lineno=
    #readline
    #readlines
    #each_line
    #each_byte
    #each_char
    #each_codepoint
2022-01-04 12:57:45 -06:00
Jeremy Evans 9e0a91d064 Don't segfault if Warning.warn is undefined
Check that there is a method entry for the method before passing
it to rb_method_entry_arity.

Fixes [Bug #18458]
2022-01-04 10:03:18 -08:00
git e7806049c0 * 2022-01-05 [ci skip] 2022-01-05 00:28:02 +09:00
Matt Valentine-House ad007bc6ea Switch `is_pointer_to_heap` to use library bsearch
This commit switches from a custom implemented bsearch algorithm to
use the one provided by the C standard library.

Because `is_pointer_to_heap` will only return true if the pointer
being searched for is a valid slot starting address within the heap
page body, we've extracted the bsearch call site into a more general
function so we can use it elsewhere.

The new function `heap_page_for_ptr` returns the heap page for any heap
page pointer, regardless of whether that is at the start of a slot or
in the middle of one.

We then use this function as the basis of `is_pointer_to_heap`.
2022-01-04 10:27:46 -05:00
Peter Zhu 615e9b2865 [Feature #18364] Add GC.stat_heap to get stats for memory heaps
GC.stat_heap will return stats for memory heaps. This is
used for the Variable Width Allocation feature.
2022-01-04 09:46:36 -05:00
Yusuke Endoh e9a4cc02b4 [ruby/error_highlight] Add a test to check if it is robust against a spoofed filename
Previously, RubyVM::AST.of opened a wrong file if the iseq's file path is spoofed.

```
module Dummy
  binding.irb
end
```

```
$ ruby test.rb

From: test.rb @ line 2 :

    1: module Dummy
 => 2:   binding.irb
    3: end

irb(Dummy):001:0> foo
/home/mame/work/ruby/local/lib/ruby/3.1.0/error_highlight/base.rb:412:in `spot_colon2': undefined method `last_lineno' for nil:NilClass (NoMethodError)

      if nd_parent.last_lineno == @node.last_lineno
                  ^^^^^^^^^^^^
```

Found by @kateinoigakukun

This issue is already fixed in the interpreter side.
This change just adds a test for the case.

https://github.com/ruby/error_highlight/commit/f3626b9032
2022-01-04 23:18:37 +09:00
Christian Boos 11b1ebe606 [ruby/error_highlight] Fix the spurious TypeError.
When we have no backtrace locations, we can't have the highlight,
so just return the message.

https://github.com/ruby/error_highlight/commit/9f5c639494
2022-01-04 23:09:01 +09:00
Christian Boos e22218b510 [ruby/error_highlight] Reproduce the error seen when calling .to_s in embedded Ruby
The test fails with the following error:

Error: test_simulate_funcallv_from_embedded_ruby(ErrorHighlightTest): TypeError: wrong argument type nil (expected method)

https://github.com/ruby/error_highlight/commit/52943c9cd2
2022-01-04 23:09:00 +09:00
Yusuke Endoh b673e9a304 Fix the previous commit 2022-01-04 17:52:07 +09:00
Yusuke Endoh 426ddbfff5 test/ruby/test_method.rb: Fix a random failure during `make COVERAGE=1`
This fixes the following failure.

```
1) Error:
TestMethod#test_method_list:
NoMethodError: undefined method `<=>' for #<BasicObject:0x00007f7757e7eb60>

      mods = mods.sort_by {|m| m.name }
                 ^^^^^^^^
```
https://github.com/ruby/actions/runs/4699487470?check_suite_focus=true

TestNoMethodError#test_to_s creates an anonymous module whose `#name`
method returns a BasicObject.

f0669fb6cb/test/ruby/test_nomethod_error.rb (L95-L99)

TestMethod#test_method_list uses `ObjectSpace.each_object(Module)` to
gather all Modules and attempts to sort them by `#name`.
But the anonymous module returns a BasicObject, which leads to the test
failure above.
2022-01-04 17:34:28 +09:00
Hiroshi SHIBATA 47bf64a26d
Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
David Rodríguez f0669fb6cb [ruby/optparse] Use `require_relative` for internal requires (https://github.com/ruby/optparse/pull/28)
https://github.com/ruby/optparse/commit/e4f2682128
2022-01-04 16:38:17 +09:00
Nobuyoshi Nakada 5074aa1984 [rubygems/rubygems] Test the actual checksums of the mock gems
https://github.com/rubygems/rubygems/commit/2b42630959
2022-01-04 14:59:18 +09:00
Nobuyoshi Nakada 0bfb406b75 [rubygems/rubygems] Fix the test to use the mock gem path
"NUL.*" means the NUL device on Windows, as well as mere "NUL",
and no data is read.

https://github.com/rubygems/rubygems/commit/e2c7d22745
2022-01-04 14:59:17 +09:00
Nobuyoshi Nakada 8f9623741a [rubygems/rubygems] Append a newline to the checksum file
https://github.com/rubygems/rubygems/commit/48ea2778e9
2022-01-04 14:59:17 +09:00
Nobuyoshi Nakada c2e8e1f6a4 [rubygems/rubygems] Fix checksum
Calculate the checksum of the content, not the given pathname at
the build time itself.

https://github.com/rubygems/rubygems/commit/b60ee97ee9
2022-01-04 14:59:16 +09:00
Jeremy Evans 67612dadbc [ruby/net-http] Handle invalid use of IP addresses in SNI
Server Name Indication does not allow IP addresses (RFC 6066, section 3:
`Literal IPv4 and IPv6 addresses are not permitted in "HostName".`).

Recent versions of LibreSSL enforce this restriction, which raises
when setting the hostname to an IP address (s.hostname=), before
attempting to setup the SSL connection.

Since the certificate used in the test is already for localhost,
we cannot connect to localhost.  However, as all the test does is
check for a specific exception, just modify the regexp used so it
handles both cases.

https://github.com/ruby/net-http/commit/6ab399db45
2022-01-04 08:25:58 +09:00
git 8d6e4f1565 * 2022-01-04 [ci skip] 2022-01-04 05:11:49 +09:00
Alan Wu 3ae8b115c2 YJIT: Fix confusing self reference when initializing variable 2022-01-03 12:43:23 -05:00
Alan Wu c717728830 YJIT: Refine comments
Correct method name, fix copypasta, and add an ASCII illustration.

[ci skip]
2022-01-03 12:43:08 -05:00
卜部昌平 980bf94f02
Kernel#=~: delete
Has been deprecated since ebff9dc10e.
2022-01-03 22:33:38 +09:00
git 3ff762cc7c * 2022-01-03 [ci skip] 2022-01-03 07:06:44 +09:00