summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cont.c b/cont.c
index e050deefdc..49629efd90 100644
--- a/cont.c
+++ b/cont.c
@@ -2090,10 +2090,17 @@ fiber_storage_validate_each(VALUE key, VALUE value, VALUE _argument)
static void
fiber_storage_validate(VALUE value)
{
+ // nil is an allowed value and will be lazily initialized.
+ if (value == Qnil) return;
+
if (!RB_TYPE_P(value, T_HASH)) {
rb_raise(rb_eTypeError, "storage must be a hash");
}
+ if (RB_OBJ_FROZEN(value)) {
+ rb_raise(rb_eFrozenError, "storage must not be frozen");
+ }
+
rb_hash_foreach(value, fiber_storage_validate_each, Qundef);
}