Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 68 additions & 62 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ Note that each entry is kept to a minimum, see links for details.

Note: We're only listing outstanding class updates.

* Array

* `Array#rfind` has been added as a more efficient alternative to `array.reverse_each.find` [[Feature #21678]]
* `Array#find` has been added as a more efficient override of `Enumerable#find` [[Feature #21678]]
* `Array#pack` accepts a new format `R` and `r` for unpacking unsigned
and signed LEB128 encoded integers. [[Feature #21785]]

* Binding

* `Binding#local_variables` does no longer include numbered parameters.
Also, `Binding#local_variable_get`, `Binding#local_variable_set`, and
`Binding#local_variable_defined?` reject to handle numbered parameters.
[[Bug #21049]]

* `Binding#implicit_parameters`, `Binding#implicit_parameter_get`, and
`Binding#implicit_parameter_defined?` have been added to access
numbered parameters and "it" parameter. [[Bug #21049]]

* Enumerator

* `Enumerator.produce` now accepts an optional `size` keyword argument
Expand All @@ -57,47 +75,6 @@ Note: We're only listing outstanding class updates.

[[Feature #21701]]

* Kernel

* `Kernel#inspect` now checks for the existence of a `#instance_variables_to_inspect` method,
allowing control over which instance variables are displayed in the `#inspect` string:

```ruby
class DatabaseConfig
def initialize(host, user, password)
@host = host
@user = user
@password = password
end

private def instance_variables_to_inspect = [:@host, :@user]
end

conf = DatabaseConfig.new("localhost", "root", "hunter2")
conf.inspect #=> #<DatabaseConfig:0x0000000104def350 @host="localhost", @user="root">
```

[[Feature #21219]]

* A deprecated behavior, process creation by `Kernel#open` with a
leading `|`, was removed. [[Feature #19630]]

* Array

* `Array#rfind` has been added as a more efficient alternative to `array.reverse_each.find` [[Feature #21678]]
* `Array#find` has been added as a more efficient override of `Enumerable#find` [[Feature #21678]]

* Binding

* `Binding#local_variables` does no longer include numbered parameters.
Also, `Binding#local_variable_get`, `Binding#local_variable_set`, and
`Binding#local_variable_defined?` reject to handle numbered parameters.
[[Bug #21049]]

* `Binding#implicit_parameters`, `Binding#implicit_parameter_get`, and
`Binding#implicit_parameter_defined?` have been added to access
numbered parameters and "it" parameter. [[Bug #21049]]

* ErrorHighlight

* When an ArgumentError is raised, it now displays code snippets for
Expand All @@ -116,6 +93,18 @@ Note: We're only listing outstanding class updates.
from test.rb:3:in '<main>'
```

* Fiber

* Introduce support for `Fiber#raise(cause:)` argument similar to
`Kernel#raise`. [[Feature #21360]]

* Fiber::Scheduler

* Introduce `Fiber::Scheduler#fiber_interrupt` to interrupt a fiber with a
given exception. The initial use case is to interrupt a fiber that is
waiting on a blocking IO operation when the IO operation is closed.
[[Feature #21166]]

* File

* `File::Stat#birthtime` is now available on Linux via the statx
Expand All @@ -130,10 +119,40 @@ Note: We're only listing outstanding class updates.
* A deprecated behavior, process creation by `IO` class methods
with a leading `|`, was removed. [[Feature #19630]]

* Kernel

* `Kernel#inspect` now checks for the existence of a `#instance_variables_to_inspect` method,
allowing control over which instance variables are displayed in the `#inspect` string:

```ruby
class DatabaseConfig
def initialize(host, user, password)
@host = host
@user = user
@password = password
end

private def instance_variables_to_inspect = [:@host, :@user]
end

conf = DatabaseConfig.new("localhost", "root", "hunter2")
conf.inspect #=> #<DatabaseConfig:0x0000000104def350 @host="localhost", @user="root">
```

[[Feature #21219]]

* A deprecated behavior, process creation by `Kernel#open` with a
leading `|`, was removed. [[Feature #19630]]

* Math

* `Math.log1p` and `Math.expm1` are added. [[Feature #21527]]

* Pathname

* Pathname has been promoted from a default gem to a core class of Ruby.
[[Feature #17473]]

* Proc

* `Proc#parameters` now shows anonymous optional parameters as `[:opt]`
Expand Down Expand Up @@ -239,28 +258,14 @@ Note: We're only listing outstanding class updates.
* `String#strip`, `strip!`, `lstrip`, `lstrip!`, `rstrip`, and `rstrip!`
are extended to accept `*selectors` arguments. [[Feature #21552]]

* `String#unpack` accepts a new format `R` and `r` for unpacking unsigned
and signed LEB128 encoded integers. [[Feature #21785]]

* Thread

* Introduce support for `Thread#raise(cause:)` argument similar to
`Kernel#raise`. [[Feature #21360]]

* Fiber

* Introduce support for `Fiber#raise(cause:)` argument similar to
`Kernel#raise`. [[Feature #21360]]

* Fiber::Scheduler

* Introduce `Fiber::Scheduler#fiber_interrupt` to interrupt a fiber with a
given exception. The initial use case is to interrupt a fiber that is
waiting on a blocking IO operation when the IO operation is closed.
[[Feature #21166]]

* Pathname

* Pathname has been promoted from a default gem to a core class of Ruby.
[[Feature #17473]]

## Stdlib updates

The following bundled gems are promoted from default gems.
Expand Down Expand Up @@ -308,7 +313,7 @@ The following default gems are updated.
* openssl 4.0.0
* optparse 0.8.1
* pp 0.6.3
* prism 1.6.0
* prism 1.7.0
* psych 5.3.1
* resolv 0.7.0
* stringio 3.2.0
Expand All @@ -324,19 +329,19 @@ The following bundled gems are added.

The following bundled gems are updated.

* minitest 5.27.0
* minitest 6.0.0
* power_assert 3.0.1
* rake 13.3.1
* test-unit 3.7.3
* rexml 3.4.4
* net-ftp 0.3.9
* net-imap 0.6.1
* net-imap 0.6.2
* net-smtp 0.5.1
* matrix 0.4.3
* prime 0.1.4
* rbs 3.10.0.pre.2
* typeprof 0.31.0
* debug 1.11.0
* debug 1.11.1
* base64 0.3.0
* bigdecimal 4.0.1
* drb 2.2.3
Expand Down Expand Up @@ -545,3 +550,4 @@ A lot of work has gone into making Ractors more stable, performant, and usable.
[Feature #21678]: https://bugs.ruby-lang.org/issues/21678
[Bug #21698]: https://bugs.ruby-lang.org/issues/21698
[Feature #21701]: https://bugs.ruby-lang.org/issues/21701
[Feature #21785]: https://bugs.ruby-lang.org/issues/21785
31 changes: 2 additions & 29 deletions bootstraptest/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$:.unshift File.join(File.dirname(__FILE__), '../lib')
retry
end
require_relative '../tool/lib/test/jobserver'

if !Dir.respond_to?(:mktmpdir)
# copied from lib/tmpdir.rb
Expand Down Expand Up @@ -110,35 +111,7 @@ def putc(c)

def wn=(wn)
unless wn == 1
if /(?:\A|\s)--jobserver-(?:auth|fds)=(?:(\d+),(\d+)|fifo:((?:\\.|\S)+))/ =~ ENV.delete("MAKEFLAGS")
begin
if fifo = $3
fifo.gsub!(/\\(?=.)/, '')
r = File.open(fifo, IO::RDONLY|IO::NONBLOCK|IO::BINARY)
w = File.open(fifo, IO::WRONLY|IO::NONBLOCK|IO::BINARY)
else
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
end
rescue
r.close if r
else
r.close_on_exec = true
w.close_on_exec = true
tokens = r.read_nonblock(wn > 0 ? wn : 1024, exception: false)
r.close
if String === tokens
tokens.freeze
auth = w
w = nil
at_exit {auth << tokens; auth.close}
wn = tokens.size + 1
else
w.close
wn = 1
end
end
end
wn = Test::JobServer.max_jobs(wn > 0 ? wn : 1024, ENV.delete("MAKEFLAGS")) || wn
if wn <= 0
require 'etc'
wn = [Etc.nprocessors / 2, 1].max
Expand Down
2 changes: 1 addition & 1 deletion common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ yes-install-for-test-bundled-gems: yes-update-default-gemspecs
$(XRUBY) -C "$(srcdir)" -r./tool/lib/gem_env.rb bin/gem \
install --no-document --conservative \
"hoe" "json-schema:5.1.0" "test-unit-rr" "simplecov" "simplecov-html" "simplecov-json" "rspec" "zeitwerk" \
"sinatra" "rack" "tilt" "mustermann" "base64" "compact_index" "rack-test" "logger" "kpeg" "tracer"
"sinatra" "rack" "tilt" "mustermann" "base64" "compact_index" "rack-test" "logger" "kpeg" "tracer" "minitest-mock"

test-bundled-gems-fetch: yes-test-bundled-gems-fetch
yes-test-bundled-gems-fetch: clone-bundled-gems-src
Expand Down
27 changes: 5 additions & 22 deletions ext/socket/ipsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,21 @@ init_inetsock_internal(VALUE v)
VALUE open_timeout = arg->open_timeout;
VALUE timeout;
VALUE starts_at;
unsigned int timeout_msec;

timeout = NIL_P(open_timeout) ? resolv_timeout : open_timeout;
timeout_msec = NIL_P(timeout) ? 0 : rsock_value_timeout_to_msec(timeout);
starts_at = current_clocktime();

arg->remote.res = rsock_addrinfo(arg->remote.host, arg->remote.serv,
family, SOCK_STREAM,
(type == INET_SERVER) ? AI_PASSIVE : 0, timeout_msec);
(type == INET_SERVER) ? AI_PASSIVE : 0, timeout);

/*
* Maybe also accept a local address
*/

if (type != INET_SERVER && (!NIL_P(arg->local.host) || !NIL_P(arg->local.serv))) {
arg->local.res = rsock_addrinfo(arg->local.host, arg->local.serv,
family, SOCK_STREAM, 0, 0);
family, SOCK_STREAM, 0, timeout);
}

VALUE io = Qnil;
Expand Down Expand Up @@ -630,14 +628,7 @@ init_fast_fallback_inetsock_internal(VALUE v)
arg->getaddrinfo_shared = NULL;

int family = arg->families[0];
unsigned int t;
if (!NIL_P(open_timeout)) {
t = rsock_value_timeout_to_msec(open_timeout);
} else if (!NIL_P(open_timeout)) {
t = rsock_value_timeout_to_msec(resolv_timeout);
} else {
t = 0;
}
VALUE t = NIL_P(open_timeout) ? resolv_timeout : open_timeout;

arg->remote.res = rsock_addrinfo(
arg->remote.host,
Expand Down Expand Up @@ -1337,15 +1328,7 @@ rsock_init_inetsock(
* Maybe also accept a local address
*/
if (!NIL_P(local_host) || !NIL_P(local_serv)) {
unsigned int t;
if (!NIL_P(open_timeout)) {
t = rsock_value_timeout_to_msec(open_timeout);
} else if (!NIL_P(open_timeout)) {
t = rsock_value_timeout_to_msec(resolv_timeout);
} else {
t = 0;
}

VALUE t = NIL_P(open_timeout) ? resolv_timeout : open_timeout;
local_res = rsock_addrinfo(
local_host,
local_serv,
Expand Down Expand Up @@ -1609,7 +1592,7 @@ static VALUE
ip_s_getaddress(VALUE obj, VALUE host)
{
union_sockaddr addr;
struct rb_addrinfo *res = rsock_addrinfo(host, Qnil, AF_UNSPEC, SOCK_STREAM, 0, 0);
struct rb_addrinfo *res = rsock_addrinfo(host, Qnil, AF_UNSPEC, SOCK_STREAM, 0, Qnil);
socklen_t len = res->ai->ai_addrlen;

/* just take the first one */
Expand Down
Loading