Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goyox86/485325 to your computer and use it in GitHub Desktop.
Save goyox86/485325 to your computer and use it in GitHub Desktop.
From 67bc1f20814ed6ce9a40fba020dcee1f9d2dbcbe Mon Sep 17 00:00:00 2001
From: Jose Narvaez <goyox86@gmail.com>
Date: Thu, 22 Jul 2010 11:21:08 -0430
Subject: [PATCH] Module#class_variable_set now raises a TypeError when self is frozen
---
vm/builtin/module.cpp | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/vm/builtin/module.cpp b/vm/builtin/module.cpp
index 6aa8630..eeeb866 100644
--- a/vm/builtin/module.cpp
+++ b/vm/builtin/module.cpp
@@ -263,6 +263,10 @@ namespace rubinius {
Object* Module::cvar_set(STATE, Symbol* name, Object* value) {
if(!name->is_cvar_p(state)->true_p()) return Primitives::failure();
+ if(RTEST(frozen_p(state))) {
+ Exception::type_error(state, "unable to change frozen object");
+ }
+
Module* mod = this;
Module* mod_to_query;
--
1.6.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment