* string.c (rb_str_inspect): don't call rb_enc_codepoint with empty

string.  fix '#'.inspect.

* encoding.c (rb_enc_codepoint): raise on empty string.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-25 09:07:32 +00:00
parent 8e4c6d8482
commit ead329fd8e
3 changed files with 13 additions and 2 deletions

View file

@ -3025,7 +3025,8 @@ rb_str_inspect(VALUE str)
p += n;
if (c == '"'|| c == '\\' ||
(c == '#' && (cc = rb_enc_codepoint(p,pend,enc),
(c == '#' && p < pend &&
(cc = rb_enc_codepoint(p,pend,enc),
(cc == '$' || cc == '@' || cc == '{')))) {
prefix_escape(result, c, enc);
}