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
23 changes: 18 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ Note: We're only listing outstanding class updates.

* Array

* `Array#pack` accepts a new format `R` and `r` for unpacking unsigned
and signed LEB128 encoded integers. [[Feature #21785]]
* `Array#pack` accepts a new format `^` that returns the current offset.
Useful when combined with variable width formats like LEB128. [[Feature #21796]]
* `Array#pack` accepts new formats `R` and `r` for unsigned and signed
LEB128 encoded integers. [[Feature #21785]]

* ENV

Expand All @@ -54,7 +52,14 @@ Note: We're only listing outstanding class updates.

* ObjectSpace

* `ObjectSpace._id2ref` was removed. [[Feature #22135]]
* `ObjectSpace._id2ref` was removed. [[Feature #22135]]

* Proc

* `Proc#refined` is added. It returns a new Proc that behaves like the
receiver but with the refinements activated by the given modules
ineffect inside its body, without affecting the original Proc.
[[Feature #22097]]

* Regexp

Expand All @@ -67,6 +72,14 @@ Note: We're only listing outstanding class updates.
* A deprecated behavior, `Set#to_set`, `Range#to_set`, and
`Enumerable#to_set` accepting arguments, was removed. [[Feature #21390]]

* String

* `String#unpack` and `String#unpack1` accept new formats `R` and `r`
for unsigned and signed LEB128 encoded integers. [[Feature #21785]]
* `String#unpack` and `String#unpack1` accept a new format `^` that
returns the current offset. Useful when combined with variable
width formats like LEB128. [[Feature #21796]]

* Symbol

* `Symbol#to_s` now returns a frozen string. [[Feature #22137]]
Expand Down
2 changes: 1 addition & 1 deletion common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ no-install-for-test-bundled-gems: no-update-default-gemspecs
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" "rspec" "zeitwerk" \
"hoe" "json-schema:5.1.0" "test-unit-rr" "rspec" "zeitwerk" \
"sinatra" "rack" "tilt" "mustermann" "base64" "compact_index" "rack-test" "logger" "kpeg" "tracer" "minitest-mock"

test-bundled-gems-fetch: yes-test-bundled-gems-fetch
Expand Down
18 changes: 14 additions & 4 deletions ext/date/date_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,16 @@ sec_fraction(VALUE f)

#define SNUM 14

#ifndef rb_streql_lit
static inline int
rb_streql_cstr(VALUE str, const char *lit, size_t len)
{
if ((size_t)RSTRING_LEN(str) != len) return 0;
return memcmp(RSTRING_PTR(str), lit, len) == 0;
}
#define rb_streql_lit(str, lit) rb_streql_cstr(str, lit, sizeof(lit "") - 1)
#endif

static int
iso8601_ext_datetime_cb(VALUE m, VALUE hash)
{
Expand All @@ -2339,14 +2349,14 @@ iso8601_ext_datetime_cb(VALUE m, VALUE hash)

if (!NIL_P(s[1])) {
if (!NIL_P(s[3])) set_hash("mday", str2num(s[3]));
if (strcmp(RSTRING_PTR(s[1]), "-") != 0) {
if (!rb_streql_lit(s[1], "-")) {
y = str2num(s[1]);
if (RSTRING_LEN(s[1]) < 4)
y = comp_year69(y);
set_hash("year", y);
}
if (NIL_P(s[2])) {
if (strcmp(RSTRING_PTR(s[1]), "-") != 0)
if (!rb_streql_lit(s[1], "-"))
return 0;
}
else
Expand Down Expand Up @@ -2425,14 +2435,14 @@ iso8601_bas_datetime_cb(VALUE m, VALUE hash)

if (!NIL_P(s[3])) {
set_hash("mday", str2num(s[3]));
if (strcmp(RSTRING_PTR(s[1]), "--") != 0) {
if (!rb_streql_lit(s[1], "--")) {
y = str2num(s[1]);
if (RSTRING_LEN(s[1]) < 4)
y = comp_year69(y);
set_hash("year", y);
}
if (*RSTRING_PTR(s[2]) == '-') {
if (strcmp(RSTRING_PTR(s[1]), "--") != 0)
if (!rb_streql_lit(s[1], "--"))
return 0;
}
else
Expand Down
20 changes: 19 additions & 1 deletion gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ rb_gc_imemo_needs_cleanup_p(VALUE obj)
return ((rb_imemo_tmpbuf_t *)obj)->ptr != NULL;

case imemo_fields:
return FL_TEST_RAW(obj, OBJ_FIELD_HEAP);
return rb_obj_shape_complex_p(obj);
}
UNREACHABLE_RETURN(true);
}
Expand Down Expand Up @@ -3156,6 +3156,24 @@ gc_mark_classext_iclass(rb_classext_t *ext, bool prime, VALUE box_value, void *a

#define TYPED_DATA_REFS_OFFSET_LIST(d) (size_t *)(uintptr_t)RTYPEDDATA_TYPE(d)->function.dmark

static inline bool
rb_obj_using_gen_fields_table_p(VALUE obj)
{
switch (BUILTIN_TYPE(obj)) {
case T_DATA:
return false;

case T_STRUCT:
if (!FL_TEST_RAW(obj, RSTRUCT_GEN_FIELDS)) return false;
break;

default:
break;
}

return rb_obj_gen_fields_p(obj);
}

void
rb_gc_move_obj_during_marking(VALUE from, VALUE to)
{
Expand Down
2 changes: 1 addition & 1 deletion gems/bundled_gems
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rake 13.4.2 https://github.com/ruby/rake
test-unit 3.7.8 https://github.com/test-unit/test-unit
rexml 3.4.4 https://github.com/ruby/rexml
rss 0.3.3 https://github.com/ruby/rss
net-imap 0.6.4.1 https://github.com/ruby/net-imap 20d4f2c39dcc12307a6b30b497565770e89b66e3
net-imap 0.6.4.1 https://github.com/ruby/net-imap
net-smtp 0.5.1 https://github.com/ruby/net-smtp
matrix 0.4.3 https://github.com/ruby/matrix
prime 0.1.4 https://github.com/ruby/prime
Expand Down
2 changes: 1 addition & 1 deletion imemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static inline void
imemo_fields_free(struct rb_fields *fields)
{
if (rb_obj_shape_complex_p((VALUE)fields)) {
st_free_table(&fields->as.complex.table);
st_free_embedded_table(&fields->as.complex.table);
}
}

Expand Down
19 changes: 0 additions & 19 deletions shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define RUBY_SHAPE_H

#include "internal/gc.h"
#include "internal/struct.h"

typedef uint8_t attr_index_t;
typedef uint32_t shape_id_t;
Expand Down Expand Up @@ -479,24 +478,6 @@ rb_obj_gen_fields_p(VALUE obj)
return rb_obj_shape_has_fields(obj);
}

static inline bool
rb_obj_using_gen_fields_table_p(VALUE obj)
{
switch (BUILTIN_TYPE(obj)) {
case T_DATA:
return false;

case T_STRUCT:
if (!FL_TEST_RAW(obj, RSTRUCT_GEN_FIELDS)) return false;
break;

default:
break;
}

return rb_obj_gen_fields_p(obj);
}

static inline shape_id_t
rb_shape_transition_layout(shape_id_t shape_id, shape_id_t layout)
{
Expand Down
4 changes: 2 additions & 2 deletions spec/ruby/core/proc/refined_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
it "returns a new Proc with the refinements of the given module activated inside its body" do
pr = -> s { s.shout }
refined = pr.refined(ProcRefinedSpecs::StringShout)
refined.should be_an_instance_of(Proc)
refined.should_not equal(pr)
refined.should.instance_of?(Proc)
refined.should_not.equal?(pr)
refined.call("hi").should == "HI!"
end

Expand Down
5 changes: 5 additions & 0 deletions tool/test-bundled-gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

ENV.delete("GNUMAKEFLAGS")

# net-imap's test helper enables SimpleCov, but its released versions still
# call the pre-1.0.0 `SimpleCov.formatters=` API that breaks with simplecov
# 1.0.0. Coverage of bundled gems is not collected in CI, so disable it.
ENV["SIMPLECOV_DISABLE"] = "1"

github_actions = ENV["GITHUB_ACTIONS"] == "true"

DEFAULT_ALLOWED_FAILURES = RUBY_PLATFORM =~ /mswin|mingw/ ? [
Expand Down