Created
July 21, 2010 23:18
-
-
Save goyox86/485291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f3a7b40a3e53bde9dd917971fd1e81f922d93b7a Mon Sep 17 00:00:00 2001 | |
From: Jose Narvaez <[email protected]> | |
Date: Wed, 21 Jul 2010 18:46:07 -0430 | |
Subject: [PATCH] Module#class_variable_set now raises a TypeError when self is frozen | |
--- | |
vm/builtin/module.cpp | 7 +++++++ | |
1 files changed, 7 insertions(+), 0 deletions(-) | |
diff --git a/vm/builtin/module.cpp b/vm/builtin/module.cpp | |
index 6aa8630..3d5c7ae 100644 | |
--- a/vm/builtin/module.cpp | |
+++ b/vm/builtin/module.cpp | |
@@ -263,6 +263,13 @@ namespace rubinius { | |
Object* Module::cvar_set(STATE, Symbol* name, Object* value) { | |
if(!name->is_cvar_p(state)->true_p()) return Primitives::failure(); | |
+ if(Object::frozen_p(state)->true_p()) { | |
+ RubyException::raise( | |
+ Exception::make_exception(state, | |
+ as<Class>(G(object)->get_const(state, "TypeError")), | |
+ "unable to modify frozen object")); | |
+ } | |
+ | |
Module* mod = this; | |
Module* mod_to_query; | |
-- | |
1.7.0.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment