From 18474514cf2c3d1fcf0e6993bd94c226fcd149c7 Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 8 Aug 2009 15:35:29 +0000 Subject: merges r24425 from trunk into ruby_1_9_1. -- * encoding.c (rb_enc_associate_index): cannot set encoding on special constants. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@24474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- encoding.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'encoding.c') diff --git a/encoding.c b/encoding.c index faebdfac8..bc960c26a 100644 --- a/encoding.c +++ b/encoding.c @@ -617,6 +617,9 @@ rb_enc_associate_index(VALUE obj, int idx) /* enc_check_capable(obj);*/ if (rb_enc_get_index(obj) == idx) return obj; + if (SPECIAL_CONST_P(obj)) { + rb_raise(rb_eArgError, "cannot set encoding"); + } if (!ENC_CODERANGE_ASCIIONLY(obj) || !rb_enc_asciicompat(rb_enc_from_index(idx))) { ENC_CODERANGE_CLEAR(obj); -- cgit