From: "vo.x (Vit Ondruch)" Date: 2022-11-30T13:39:48+00:00 Subject: [ruby-core:111089] [Ruby master Bug#18779] `GC.compact` and other compaction related methods should be defined as rb_f_notimplement on non supported platforms. Issue #18779 has been updated by vo.x (Vit Ondruch). If it helps, this [1] is the patch we are carrying around in Fedora for Ruby 3.1. I would appreciate if is backported, because it influences files which are pregenerated and part of the release tarball [2]. [1]: https://src.fedoraproject.org/rpms/ruby/blob/9819174c8dd5a04f7cc47d50d586cc6f72b8f0b7/f/ruby-3.2.0-define-unsupported-gc-compaction-methods-as-rb_f_notimplement.patch [2]: https://src.fedoraproject.org/rpms/ruby/blob/9819174c8dd5a04f7cc47d50d586cc6f72b8f0b7/f/ruby-3.2.0-define-unsupported-gc-compaction-methods_generated-files.patch ---------------------------------------- Bug #18779: `GC.compact` and other compaction related methods should be defined as rb_f_notimplement on non supported platforms. https://bugs.ruby-lang.org/issues/18779#change-100354 * Author: byroot (Jean Boussier) * Status: Closed * Priority: Normal * Backport: 2.7: WONTFIX, 3.0: REQUIRED, 3.1: REQUIRED ---------------------------------------- I received several bug report on native gems using `GC.verify_compaction_references` in their test suite. Examples: - https://github.com/msgpack/msgpack-ruby/pull/275/files - https://github.com/Shopify/bootsnap/pull/414/files I think that when `!GC_COMPACTION_SUPPORTED`, rather than raise `NotImplementedError`, we should instead define these methods as `rb_f_notimplement` like `Process.fork` on Windows. This way `GC.respond_to?(:compact)` would be a proper way to test for compaction support. Unfortunately, these methods are defined through `.rb` files with `Primitive`, and I don't know wether it's possible to check `GC_COMPACTION_SUPPORTED` from there, nor if it's possible to define a `rb_f_notimplement` method. cc @tenderlovemaking -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/