1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

error.c: suppress warnings

* error.c (rb_error_frozen_object): use rb_attr_get instead of
  rb_ivar_get to get rid of warnings for string objects created
  when frozen-string-literal-debug is disabled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-27 07:41:07 +00:00
parent 3f682c2c8a
commit caada48ee8
2 changed files with 12 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Tue Oct 27 16:41:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (rb_error_frozen_object): use rb_attr_get instead of
rb_ivar_get to get rid of warnings for string objects created
when frozen-string-literal-debug is disabled.
Tue Oct 27 16:18:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/logger.rb (Logger::Period#previous_period_end): as weekly

View file

@ -2227,8 +2227,12 @@ void
rb_error_frozen_object(VALUE frozen_obj)
{
VALUE path, line;
if ((path = rb_iv_get(frozen_obj, "__object_created_path__")) != Qnil &&
(line = rb_iv_get(frozen_obj, "__object_created_line__")) != Qnil) {
ID created_path, created_line;
CONST_ID(created_path, "__object_created_path__");
CONST_ID(created_line, "__object_created_line__");
if (!NIL_P(path = rb_attr_get(frozen_obj, created_path)) &&
!NIL_P(line = rb_attr_get(frozen_obj, created_line))) {
rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
CLASS_OF(frozen_obj), path, line);
}