From dcaee20c6908dfe8d4ae0b8e5c6f31e8fcb7c6c1 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 11 Sep 2025 14:43:23 -0400 Subject: [PATCH 1/2] Fix compilation of set_spec.c for previous Ruby versions Set was moved to C only in Ruby 3.5, so it does not compile on Ruby 3.4 and earlier. --- spec/ruby/optional/capi/ext/set_spec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/ruby/optional/capi/ext/set_spec.c b/spec/ruby/optional/capi/ext/set_spec.c index 6535a11be322df..72938be1d887f0 100644 --- a/spec/ruby/optional/capi/ext/set_spec.c +++ b/spec/ruby/optional/capi/ext/set_spec.c @@ -1,6 +1,7 @@ #include "ruby.h" #include "rubyspec.h" +#ifdef RUBY_VERSION_IS_3_5 #ifdef __cplusplus extern "C" { #endif @@ -60,3 +61,4 @@ void Init_set_spec(void) { } #endif +#endif From f7f0f67a1fcc0a4a407307b1328625f71e263cba Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 11 Sep 2025 14:48:21 -0400 Subject: [PATCH 2/2] Don't load set_spec.c if not Ruby 3.5 --- spec/ruby/optional/capi/set_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/ruby/optional/capi/set_spec.rb b/spec/ruby/optional/capi/set_spec.rb index 3433014ccd46e8..3b7ee812c56ade 100644 --- a/spec/ruby/optional/capi/set_spec.rb +++ b/spec/ruby/optional/capi/set_spec.rb @@ -1,13 +1,13 @@ require_relative 'spec_helper' -load_extension("set") +ruby_version_is "3.5" do + load_extension("set") -describe "C-API Set function" do - before :each do - @s = CApiSetSpecs.new - end + describe "C-API Set function" do + before :each do + @s = CApiSetSpecs.new + end - ruby_version_is "3.5" do describe "rb_set_foreach" do it "calls function with each element and arg" do a = []