Forum: Ruby-core [Ruby 1.9-Bug#3783][Open] Replace Calls to rb_error_frozen() with rb_check_frozen()

Posted by Run Paint Run Run (Guest)
on 2010-09-02 14:21
Attachment: rb_check_frozen.patch (8,34 KB)
(Received via mailing list)
Bug #3783: Replace Calls to rb_error_frozen() with rb_check_frozen()
http://redmine.ruby-lang.org/issues/show/3783

Author: Run Paint Run Run
Status: Open, Priority: Low
Category: core
ruby -v: ruby 1.9.3dev (2010-09-02 trunk 29167) [i686-linux]

This patch replaces lines of the form:
  if (OBJ_FROZEN(obj)) rb_error_frozen("object");
with:
  rb_check_frozen(obj);
This is simpler, and produces error messages that are more consistent 
and precise.

(It feels wrong cluttering the bug tracker with things like this. Would 
they be better posted to the list or sent as a "pull" request?)
Posted by SASADA Koichi (Guest)
on 2010-10-21 17:29
(Received via mailing list)
Hi,

(2010/09/02 13:20), Run Paint Run Run wrote:
> This patch replaces lines of the form:
>   if (OBJ_FROZEN(obj)) rb_error_frozen("object");
> with:
>   rb_check_frozen(obj);
> This is simpler, and produces error messages that are more consistent and 
precise.
>
> (It feels wrong cluttering the bug tracker with things like this. Would they be 
better posted to the list or sent as a "pull" request?)

I agree about this modification.
How about to make a macro to avoid C function call overhead?

example:

#define RB_CHECK_FROZEN(obj) \
  (OBJ_FROZEN(obj) ? rb_error_frozen(rb_obj_classname(obj) : 0)

more simply:

#define rb_check_frozen(obj) \
  (OBJ_FROZEN(obj) ? rb_error_frozen(rb_obj_classname(obj) : 0)
Posted by Nobuyoshi Nakada (Guest)
on 2010-10-24 10:17
(Received via mailing list)
Issue #3783 has been updated by Nobuyoshi Nakada.

Status changed from Open to Closed
% Done changed from 0 to 100

This issue was solved with changeset r29583.
Run Paint, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.