aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/variable.c b/variable.c
index 62256a049e..d7b99f180b 100644
--- a/variable.c
+++ b/variable.c
@@ -1633,12 +1633,19 @@ VALUE
rb_mod_remove_const(VALUE mod, VALUE name)
{
const ID id = rb_to_id(name);
- VALUE val;
- st_data_t v, n = id;
if (!rb_is_const_id(id)) {
rb_name_error(id, "`%s' is not allowed as a constant name", rb_id2name(id));
}
+ return rb_const_remove(mod, id);
+}
+
+VALUE
+rb_const_remove(VALUE mod, ID id)
+{
+ VALUE val;
+ st_data_t v, n = id;
+
if (!OBJ_UNTRUSTED(mod) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't remove constant");
if (OBJ_FROZEN(mod)) rb_error_frozen("class/module");