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
48 changes: 24 additions & 24 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,30 +177,30 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() }}

make-ibm:
strategy:
matrix:
include:
- test_task: check
os: ubuntu-24.04-ppc64le
- test_task: check
os: ubuntu-24.04-s390x
fail-fast: false

env: *make-env

runs-on: ${{ matrix.os }}

if: >-
${{github.repository == 'ruby/ruby'
&& !(false
|| contains(github.event.head_commit.message, '[DOC]')
|| contains(github.event.pull_request.title, '[DOC]')
|| contains(github.event.pull_request.labels.*.name, 'Documentation')
|| (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}

steps: *make-steps
# make-ibm:
# strategy:
# matrix:
# include:
# - test_task: check
# os: ubuntu-24.04-ppc64le
# - test_task: check
# os: ubuntu-24.04-s390x
# fail-fast: false

# env: *make-env

# runs-on: ${{ matrix.os }}

# if: >-
# ${{github.repository == 'ruby/ruby'
# && !(false
# || contains(github.event.head_commit.message, '[DOC]')
# || contains(github.event.pull_request.title, '[DOC]')
# || contains(github.event.pull_request.labels.*.name, 'Documentation')
# || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
# )}}

# steps: *make-steps

# Separated from `make` job to avoid making it a required status check
ruby-bench:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ jobs:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
iwr -useb get.scoop.sh | iex
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
scoop install vcpkg uutils-coreutils
scoop install vcpkg
scoop install uutils-coreutils@0.5.0
shell: pwsh

- name: Restore vcpkg artifact
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ releases.

* RubyGems 4.1.0.dev
* bundler 4.1.0.dev
* json 2.18.1
* prism 1.9.0
* resolv 0.7.1
* stringio 3.2.1.dev
Expand Down
2 changes: 1 addition & 1 deletion doc/language/ractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You can create multiple Ractors which can run ruby code in parallel with each ot
* Ruby processes start with one ractor (called the *main ractor*).
* If the main ractor terminates, all other ractors receive termination requests, similar to how threads behave.
* Each Ractor contains one or more `Thread`s.
* Threads within the same ractor share a ractor-wide global lock (GVL in MRI terminology), so they can't run in parallel wich each other (without releasing the GVL explicitly in C extensions). Threads in different ractors can run in parallel.
* Threads within the same ractor share a ractor-wide global lock (GVL in MRI terminology), so they can't run in parallel with each other (without releasing the GVL explicitly in C extensions). Threads in different ractors can run in parallel.
* The overhead of creating a ractor is slightly above the overhead of creating a thread.

### Limited sharing between Ractors
Expand Down
14 changes: 8 additions & 6 deletions ext/json/fbuffer/fbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,25 @@ static inline void fbuffer_append_reserved_char(FBuffer *fb, char chr)

static void fbuffer_append_str(FBuffer *fb, VALUE str)
{
const char *newstr = StringValuePtr(str);
unsigned long len = RSTRING_LEN(str);
const char *ptr;
unsigned long len;
RSTRING_GETMEM(str, ptr, len);

fbuffer_append(fb, newstr, len);
fbuffer_append(fb, ptr, len);
}

static void fbuffer_append_str_repeat(FBuffer *fb, VALUE str, size_t repeat)
{
const char *newstr = StringValuePtr(str);
unsigned long len = RSTRING_LEN(str);
const char *ptr;
unsigned long len;
RSTRING_GETMEM(str, ptr, len);

fbuffer_inc_capa(fb, repeat * len);
while (repeat) {
#if JSON_DEBUG
fb->requested = len;
#endif
fbuffer_append_reserved(fb, newstr, len);
fbuffer_append_reserved(fb, ptr, len);
repeat--;
}
}
Expand Down
44 changes: 4 additions & 40 deletions ext/json/generator/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ static void generate_json_string(FBuffer *buffer, struct generate_json_data *dat
static void generate_json_null(FBuffer *buffer, struct generate_json_data *data, VALUE obj);
static void generate_json_false(FBuffer *buffer, struct generate_json_data *data, VALUE obj);
static void generate_json_true(FBuffer *buffer, struct generate_json_data *data, VALUE obj);
#ifdef RUBY_INTEGER_UNIFICATION
static void generate_json_integer(FBuffer *buffer, struct generate_json_data *data, VALUE obj);
#endif
static void generate_json_fixnum(FBuffer *buffer, struct generate_json_data *data, VALUE obj);
static void generate_json_bignum(FBuffer *buffer, struct generate_json_data *data, VALUE obj);
static void generate_json_float(FBuffer *buffer, struct generate_json_data *data, VALUE obj);
Expand Down Expand Up @@ -815,7 +813,6 @@ static VALUE mArray_to_json(int argc, VALUE *argv, VALUE self)
return cState_partial_generate(Vstate, self, generate_json_array, Qfalse);
}

#ifdef RUBY_INTEGER_UNIFICATION
/*
* call-seq: to_json(*)
*
Expand All @@ -828,32 +825,6 @@ static VALUE mInteger_to_json(int argc, VALUE *argv, VALUE self)
return cState_partial_generate(Vstate, self, generate_json_integer, Qfalse);
}

#else
/*
* call-seq: to_json(*)
*
* Returns a JSON string representation for this Integer number.
*/
static VALUE mFixnum_to_json(int argc, VALUE *argv, VALUE self)
{
rb_check_arity(argc, 0, 1);
VALUE Vstate = cState_from_state_s(cState, argc == 1 ? argv[0] : Qnil);
return cState_partial_generate(Vstate, self, generate_json_fixnum, Qfalse);
}

/*
* call-seq: to_json(*)
*
* Returns a JSON string representation for this Integer number.
*/
static VALUE mBignum_to_json(int argc, VALUE *argv, VALUE self)
{
rb_check_arity(argc, 0, 1);
VALUE Vstate = cState_from_state_s(cState, argc == 1 ? argv[0] : Qnil);
return cState_partial_generate(Vstate, self, generate_json_bignum, Qfalse);
}
#endif

/*
* call-seq: to_json(*)
*
Expand Down Expand Up @@ -1374,18 +1345,16 @@ static void generate_json_fixnum(FBuffer *buffer, struct generate_json_data *dat
static void generate_json_bignum(FBuffer *buffer, struct generate_json_data *data, VALUE obj)
{
VALUE tmp = rb_funcall(obj, i_to_s, 0);
fbuffer_append_str(buffer, tmp);
fbuffer_append_str(buffer, StringValue(tmp));
}

#ifdef RUBY_INTEGER_UNIFICATION
static void generate_json_integer(FBuffer *buffer, struct generate_json_data *data, VALUE obj)
{
if (FIXNUM_P(obj))
generate_json_fixnum(buffer, data, obj);
else
generate_json_bignum(buffer, data, obj);
}
#endif

static void generate_json_float(FBuffer *buffer, struct generate_json_data *data, VALUE obj)
{
Expand Down Expand Up @@ -1540,7 +1509,9 @@ static VALUE cState_partial_generate(VALUE self, VALUE obj, generator_func func,
.obj = obj,
.func = func
};
return rb_ensure(generate_json_try, (VALUE)&data, generate_json_ensure, (VALUE)&data);
VALUE result = rb_ensure(generate_json_try, (VALUE)&data, generate_json_ensure, (VALUE)&data);
RB_GC_GUARD(self);
return result;
}

/* call-seq:
Expand Down Expand Up @@ -2163,16 +2134,9 @@ void Init_generator(void)
VALUE mArray = rb_define_module_under(mGeneratorMethods, "Array");
rb_define_method(mArray, "to_json", mArray_to_json, -1);

#ifdef RUBY_INTEGER_UNIFICATION
VALUE mInteger = rb_define_module_under(mGeneratorMethods, "Integer");
rb_define_method(mInteger, "to_json", mInteger_to_json, -1);
#else
VALUE mFixnum = rb_define_module_under(mGeneratorMethods, "Fixnum");
rb_define_method(mFixnum, "to_json", mFixnum_to_json, -1);

VALUE mBignum = rb_define_module_under(mGeneratorMethods, "Bignum");
rb_define_method(mBignum, "to_json", mBignum_to_json, -1);
#endif
VALUE mFloat = rb_define_module_under(mGeneratorMethods, "Float");
rb_define_method(mFloat, "to_json", mFloat_to_json, -1);

Expand Down
2 changes: 1 addition & 1 deletion ext/json/lib/json/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module JSON
VERSION = '2.18.0'
VERSION = '2.18.1'
end
9 changes: 5 additions & 4 deletions lib/prism/lex_compat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,9 @@ def result
end
end

# Drop the EOF token from the list
tokens = tokens[0...-1]
# Drop the EOF token from the list. The EOF token may not be
# present if the source was syntax invalid
tokens = tokens[0...-1] if tokens.dig(-1, 1) == :on_eof

# We sort by location because Ripper.lex sorts.
tokens.sort_by! do |token|
Expand Down Expand Up @@ -804,7 +805,7 @@ def insert_on_sp(tokens, source, data_loc, bom, eof_token)
next_whitespace_index += 1
first_whitespace = sp_value[0...continuation_index]
continuation = sp_value[continuation_index...next_whitespace_index]
second_whitespace = sp_value[next_whitespace_index..]
second_whitespace = sp_value[next_whitespace_index..] || ""

new_tokens << [[sp_line, sp_column], :on_sp, first_whitespace, prev_token_state] unless first_whitespace.empty?
new_tokens << [[sp_line, sp_column + continuation_index], :on_sp, continuation, prev_token_state]
Expand All @@ -819,7 +820,7 @@ def insert_on_sp(tokens, source, data_loc, bom, eof_token)
prev_token_end = start_offset + token[2].bytesize
end

unless data_loc # no trailing :on_sp with __END__ as it is always preceded by :on_nl
if !data_loc && eof_token # no trailing :on_sp with __END__ as it is always preceded by :on_nl
end_offset = eof_token.location.end_offset
if prev_token_end < end_offset
new_tokens << [
Expand Down
44 changes: 30 additions & 14 deletions lib/rubygems/vendor/resolv/lib/resolv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require_relative '../../../vendored_timeout'
require 'io/wait'
require_relative '../../../vendored_securerandom'
require 'rbconfig'

# Gem::Resolv is a thread-aware DNS resolver library written in Ruby. Gem::Resolv can
# handle multiple DNS requests concurrently without blocking the entire Ruby
Expand Down Expand Up @@ -33,7 +34,8 @@

class Gem::Resolv

VERSION = "0.6.2"
# The version string
VERSION = "0.7.0"

##
# Looks up the first IP address for +name+.
Expand Down Expand Up @@ -173,21 +175,19 @@ class ResolvError < StandardError; end

class ResolvTimeout < Gem::Timeout::Error; end

WINDOWS = /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM || ::RbConfig::CONFIG['host_os'] =~ /mswin/
private_constant :WINDOWS

##
# Gem::Resolv::Hosts is a hostname resolver that uses the system hosts file.

class Hosts
if WINDOWS
if /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM || ::RbConfig::CONFIG['host_os'] =~ /mswin/
begin
require 'win32/resolv' unless defined?(Win32::Resolv)
DefaultFileName = Win32::Resolv.get_hosts_path || IO::NULL
hosts = Win32::Resolv.get_hosts_path || IO::NULL
rescue LoadError
end
end
DefaultFileName ||= '/etc/hosts'
# The default file name for host names
DefaultFileName = hosts || '/etc/hosts'

##
# Creates a new Gem::Resolv::Hosts, using +filename+ for its data source.
Expand Down Expand Up @@ -525,6 +525,8 @@ def each_resource(name, typeclass, &proc)
}
end

# :stopdoc:

def fetch_resource(name, typeclass)
lazy_initialize
truncated = {}
Expand Down Expand Up @@ -1021,8 +1023,7 @@ def Config.parse_resolv_conf(filename)
def Config.default_config_hash(filename="/etc/resolv.conf")
if File.exist? filename
Config.parse_resolv_conf(filename)
elsif WINDOWS
require 'win32/resolv' unless defined?(Win32::Resolv)
elsif defined?(Win32::Resolv)
search, nameserver = Win32::Resolv.get_resolv_info
config_hash = {}
config_hash[:nameserver] = nameserver if nameserver
Expand Down Expand Up @@ -2926,15 +2927,21 @@ class HTTPS < ServiceBinding

class IPv4

##
# Regular expression IPv4 addresses must match.

Regex256 = /0
|1(?:[0-9][0-9]?)?
|2(?:[0-4][0-9]?|5[0-5]?|[6-9])?
|[3-9][0-9]?/x
|[3-9][0-9]?/x # :nodoc:

##
# Regular expression IPv4 addresses must match.
Regex = /\A(#{Regex256})\.(#{Regex256})\.(#{Regex256})\.(#{Regex256})\z/

##
# Creates a new IPv4 address from +arg+ which may be:
#
# IPv4:: returns +arg+.
# String:: +arg+ must match the IPv4::Regex constant

def self.create(arg)
case arg
when IPv4
Expand Down Expand Up @@ -3243,13 +3250,15 @@ def make_udp_requester # :nodoc:

end

module LOC
module LOC # :nodoc:

##
# A Gem::Resolv::LOC::Size

class Size

# Regular expression LOC size must match.

Regex = /^(\d+\.*\d*)[m]$/

##
Expand All @@ -3275,6 +3284,7 @@ def self.create(arg)
end
end

# Internal use; use self.create.
def initialize(scalar)
@scalar = scalar
end
Expand Down Expand Up @@ -3312,6 +3322,8 @@ def hash # :nodoc:

class Coord

# Regular expression LOC Coord must match.

Regex = /^(\d+)\s(\d+)\s(\d+\.\d+)\s([NESW])$/

##
Expand Down Expand Up @@ -3341,6 +3353,7 @@ def self.create(arg)
end
end

# Internal use; use self.create.
def initialize(coordinates,orientation)
unless coordinates.kind_of?(String)
raise ArgumentError.new("Coord must be a 32bit unsigned integer in hex format: #{coordinates.inspect}")
Expand Down Expand Up @@ -3403,6 +3416,8 @@ def hash # :nodoc:

class Alt

# Regular expression LOC Alt must match.

Regex = /^([+-]*\d+\.*\d*)[m]$/

##
Expand All @@ -3428,6 +3443,7 @@ def self.create(arg)
end
end

# Internal use; use self.create.
def initialize(altitude)
@altitude = altitude
end
Expand Down
Loading