From: "nobu (Nobuyoshi Nakada) via ruby-core" Date: 2026-04-12T04:52:34+00:00 Subject: [ruby-core:125239] [Ruby Bug#21992] Defining BasicObject#initialize causes segmentation fault Issue #21992 has been updated by nobu (Nobuyoshi Nakada). Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED petercooper (Peter Cooper) wrote: > In Ruby HEAD, 4.0.2, 3.4.7, and 3.3.11 on macOS, this leads to an immediate segmentation fault. I also got this on Ruby 3.4.1 on Linux. It looks like since 3.2 (commit:9c5e3671ebd9c07c178ca5dac08ad15ad1eae411). > What I would expect, a warning similar to that raised if you do the same on `Object`. `BasicObject#initialize` is not defined, so "redefining" may be questionable. Rather it might to be OK to prohibit the definition of `BasicObject#initialize`, I think. ---------------------------------------- Bug #21992: Defining BasicObject#initialize causes segmentation fault https://bugs.ruby-lang.org/issues/21992#change-116978 * Author: petercooper (Peter Cooper) * Status: Open * ruby -v: 4.0.2 * Backport: 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED ---------------------------------------- Simplest reproduction: ``` ruby class BasicObject def initialize end end ``` In Ruby HEAD, 4.0.2, 3.4.7, and 3.3.11 on macOS, this leads to an immediate segmentation fault. I also got this on Ruby 3.4.1 on Linux. What I would expect, a warning similar to that raised if you do the same on `Object`. I couldn't find a previous mention of this. It's not something you would ever write yourself, but I guess it could arise during metaprogramming or dynamic code generation with the right (wrong) constant name in play. -- 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/lists/ruby-core.ml.ruby-lang.org/