From a60cd8787cb65a6077f609652f6042143d81b227 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 26 Nov 2025 14:37:30 -0800 Subject: [PATCH] Error if deleting a nonexistent obj from geniv I don't think this ever happened, but we should raise the same error we'd raise on lookup --- variable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/variable.c b/variable.c index f7ee561220..d4c5d91e25 100644 --- a/variable.c +++ b/variable.c @@ -1317,7 +1317,9 @@ rb_free_generic_ivar(VALUE obj) ec->gen_fields_cache.fields_obj = Qundef; } RB_VM_LOCKING() { - st_delete(generic_fields_tbl_no_ractor_check(), &key, &value); + if (!st_delete(generic_fields_tbl_no_ractor_check(), &key, &value)) { + rb_bug("Object is missing entry in generic_fields_tbl"); + } } } }