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
2 changes: 1 addition & 1 deletion .github/workflows/auto_review_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- uses: ruby/setup-ruby@ab177d40ee5483edb974554986f56b33477e21d0 # v1.265.0
with:
Expand Down
4 changes: 4 additions & 0 deletions ext/stringio/stringio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,9 @@ Init_stringio(void)
rb_define_method(StringIO, "set_encoding_by_bom", strio_set_encoding_by_bom, 0);

{
/* :stopdoc: */
VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable");
/* :startdoc: */
rb_define_method(mReadable, "readchar", strio_readchar, 0);
rb_define_method(mReadable, "readbyte", strio_readbyte, 0);
rb_define_method(mReadable, "readline", strio_readline, -1);
Expand All @@ -2254,7 +2256,9 @@ Init_stringio(void)
rb_include_module(StringIO, mReadable);
}
{
/* :stopdoc: */
VALUE mWritable = rb_define_module_under(rb_cIO, "generic_writable");
/* :startdoc: */
rb_define_method(mWritable, "<<", strio_addstr, 1);
rb_define_method(mWritable, "print", strio_print, -1);
rb_define_method(mWritable, "printf", strio_printf, -1);
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/current_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.current_ruby
end

class CurrentRuby
ALL_RUBY_VERSIONS = [*18..27, *30..34, *40].freeze
ALL_RUBY_VERSIONS = [*18..27, *30..34, 40].freeze
KNOWN_MINOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze
KNOWN_MAJOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze
PLATFORM_MAP = {
Expand Down
4 changes: 4 additions & 0 deletions lib/cgi/escape.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# frozen_string_literal: true

# :stopdoc
class CGI
module Escape; end
include Escape
extend Escape
module EscapeExt; end # :nodoc:
end
# :startdoc:

# Escape/unescape for CGI, HTML, URI.
module CGI::Escape
@@accept_charset = Encoding::UTF_8 unless defined?(@@accept_charset)

Expand Down
39 changes: 31 additions & 8 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,7 @@ def initialize(address, port = nil) # :nodoc:
@debug_output = options[:debug_output]
@response_body_encoding = options[:response_body_encoding]
@ignore_eof = options[:ignore_eof]
@tcpsocket_supports_open_timeout = nil

@proxy_from_env = false
@proxy_uri = nil
Expand Down Expand Up @@ -1672,14 +1673,36 @@ def connect
end

debug "opening connection to #{conn_addr}:#{conn_port}..."
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
begin
TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
rescue => e
raise e, "Failed to open TCP connection to " +
"#{conn_addr}:#{conn_port} (#{e.message})"
end
}
begin
s =
case @tcpsocket_supports_open_timeout
when nil, true
begin
# Use built-in timeout in TCPSocket.open if available
sock = TCPSocket.open(conn_addr, conn_port, @local_host, @local_port, open_timeout: @open_timeout)
@tcpsocket_supports_open_timeout = true
sock
rescue ArgumentError => e
raise if !(e.message.include?('unknown keyword: :open_timeout') || e.message.include?('wrong number of arguments (given 5, expected 2..4)'))
@tcpsocket_supports_open_timeout = false

# Fallback to Timeout.timeout if TCPSocket.open does not support open_timeout
Timeout.timeout(@open_timeout, Net::OpenTimeout) {
TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
}
end
when false
# The current Ruby is known to not support TCPSocket(open_timeout:).
# Directly fall back to Timeout.timeout to avoid performance penalty incured by rescue.
Timeout.timeout(@open_timeout, Net::OpenTimeout) {
TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
}
end
rescue => e
e = Net::OpenTimeout.new(e) if e.is_a?(Errno::ETIMEDOUT) # for compatibility with previous versions
raise e, "Failed to open TCP connection to " +
"#{conn_addr}:#{conn_port} (#{e.message})"
end
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
debug "opened"
if use_ssl?
Expand Down
1 change: 1 addition & 0 deletions lib/net/http/responses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module Net

# Unknown HTTP response
class HTTPUnknownResponse < HTTPResponse
# :stopdoc:
HAS_BODY = true
Expand Down
2 changes: 1 addition & 1 deletion lib/resolv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3250,7 +3250,7 @@ def make_udp_requester # :nodoc:

end

module LOC
module LOC # :nodoc:

##
# A Resolv::LOC::Size
Expand Down
138 changes: 69 additions & 69 deletions lib/rubygems/deprecate.rb
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
# frozen_string_literal: true

##
# Provides 3 methods for declaring when something is going away.
#
# +deprecate(name, repl, year, month)+:
# Indicate something may be removed on/after a certain date.
#
# +rubygems_deprecate(name, replacement=:none)+:
# Indicate something will be removed in the next major RubyGems version,
# and (optionally) a replacement for it.
#
# +rubygems_deprecate_command+:
# Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
# removed in the next RubyGems version.
#
# Also provides +skip_during+ for temporarily turning off deprecation warnings.
# This is intended to be used in the test suite, so deprecation warnings
# don't cause test failures if you need to make sure stderr is otherwise empty.
#
#
# Example usage of +deprecate+ and +rubygems_deprecate+:
#
# class Legacy
# def self.some_class_method
# # ...
# end
#
# def some_instance_method
# # ...
# end
#
# def some_old_method
# # ...
# end
#
# extend Gem::Deprecate
# deprecate :some_instance_method, "X.z", 2011, 4
# rubygems_deprecate :some_old_method, "Modern#some_new_method"
#
# class << self
# extend Gem::Deprecate
# deprecate :some_class_method, :none, 2011, 4
# end
# end
#
#
# Example usage of +rubygems_deprecate_command+:
#
# class Gem::Commands::QueryCommand < Gem::Command
# extend Gem::Deprecate
# rubygems_deprecate_command
#
# # ...
# end
#
#
# Example usage of +skip_during+:
#
# class TestSomething < Gem::Testcase
# def test_some_thing_with_deprecations
# Gem::Deprecate.skip_during do
# actual_stdout, actual_stderr = capture_output do
# Gem.something_deprecated
# end
# assert_empty actual_stdout
# assert_equal(expected, actual_stderr)
# end
# end
# end

module Gem
##
# Provides 3 methods for declaring when something is going away.
#
# <tt>deprecate(name, repl, year, month)</tt>:
# Indicate something may be removed on/after a certain date.
#
# <tt>rubygems_deprecate(name, replacement=:none)</tt>:
# Indicate something will be removed in the next major RubyGems version,
# and (optionally) a replacement for it.
#
# +rubygems_deprecate_command+:
# Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
# removed in the next RubyGems version.
#
# Also provides +skip_during+ for temporarily turning off deprecation warnings.
# This is intended to be used in the test suite, so deprecation warnings
# don't cause test failures if you need to make sure stderr is otherwise empty.
#
#
# Example usage of +deprecate+ and +rubygems_deprecate+:
#
# class Legacy
# def self.some_class_method
# # ...
# end
#
# def some_instance_method
# # ...
# end
#
# def some_old_method
# # ...
# end
#
# extend Gem::Deprecate
# deprecate :some_instance_method, "X.z", 2011, 4
# rubygems_deprecate :some_old_method, "Modern#some_new_method"
#
# class << self
# extend Gem::Deprecate
# deprecate :some_class_method, :none, 2011, 4
# end
# end
#
#
# Example usage of +rubygems_deprecate_command+:
#
# class Gem::Commands::QueryCommand < Gem::Command
# extend Gem::Deprecate
# rubygems_deprecate_command
#
# # ...
# end
#
#
# Example usage of +skip_during+:
#
# class TestSomething < Gem::Testcase
# def test_some_thing_with_deprecations
# Gem::Deprecate.skip_during do
# actual_stdout, actual_stderr = capture_output do
# Gem.something_deprecated
# end
# assert_empty actual_stdout
# assert_equal(expected, actual_stderr)
# end
# end
# end

module Deprecate
def self.skip # :nodoc:
@skip ||= false
Expand Down
2 changes: 1 addition & 1 deletion test/resolv/test_dns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def test_no_server
if RUBY_PLATFORM.match?(/mingw/)
# cannot repo locally
omit 'Timeout Error on MinGW CI'
elsif macos?(26,1)
elsif macos?([26,1]..)
omit 'Timeout Error on macOS 26.1+'
else
raise Timeout::Error
Expand Down
2 changes: 1 addition & 1 deletion test/stringio/test_stringio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ def test_overflow
intptr_max = RbConfig::LIMITS["INTPTR_MAX"]
return if intptr_max > StringIO::MAX_LENGTH
limit = intptr_max - 0x10
assert_separately(%w[-rstringio], "#{<<-"begin;"}\n#{<<-"end;"}")
assert_separately(%w[-W0 -rstringio], "#{<<-"begin;"}\n#{<<-"end;"}")
begin;
limit = #{limit}
ary = []
Expand Down