Skip to content

Commit

Permalink
Don't compile rb_undefine_finalizer on Ruby 3.4.0 and 3.4.1
Browse files Browse the repository at this point in the history
Ruby 3.4.0 and 3.4.1 have a bug where rb_undefine_finalizer is missing.
This may fail to compile on some platforms.
  • Loading branch information
peterzhu2118 committed Jan 17, 2025
1 parent 26d393d commit 281e53f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions optional/capi/ext/finalizer_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ static VALUE define_finalizer(VALUE self, VALUE obj, VALUE finalizer) {
}

static VALUE undefine_finalizer(VALUE self, VALUE obj) {
// Ruby 3.4.0 and 3.4.1 have a bug where rb_undefine_finalizer is missing
// See: https://bugs.ruby-lang.org/issues/20981
#if RUBY_API_VERSION_CODE == 30400 && (RUBY_VERSION_TEENY == 0 || RUBY_VERSION_TEENY == 1)
return Qnil;
#else
return rb_undefine_finalizer(obj);
#endif
}

void Init_finalizer_spec(void) {
Expand Down

0 comments on commit 281e53f

Please sign in to comment.