diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-12-10 13:54:53 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-10 13:54:53 +1300 |
commit | 22d391dc637dd756fdcdfc0ece4a71753b5b2ddb (patch) | |
tree | 3f52dd933eccbed682aa8b3ccd5a22fd05a257f0 /cont.c | |
parent | 24043031be75cb5119cc4a6c1ffb2c867b567633 (diff) |
Add spec for fiber storage. (#6896)
Notes
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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); } |