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]
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
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`.
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
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.
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