Fronzen string cannot unpack("p")

[email protected]$G$9!#e(B

1.9e$B$G!"e(Bpack(“p”)e$B$7$F$G$-$?e(BStringe$B$re(Bfreezee$B$9$k$H!"e(Bunpacke$B$G$-$J$/$Je(B
e$B$j$^$9!#e(B1.8e$B$G$O$G$-$^$9!#e(B

$ ruby19 -v -e ‘[""].pack(“p”).freeze.unpack(“p”)’
ruby 1.9.0 (2008-01-22 revision 15165) [i686-linux]
-e:1:in unpack': no associated pointer (ArgumentError) from -e:1:in

Index: string.c

— string.c (revision 15173)
+++ string.c (working copy)
@@ -772,4 +772,5 @@ rb_str_associate(VALUE str, VALUE add)
}
FL_SET(str, STR_ASSOC);

  • RBASIC(add)->klass = 0;
    RSTRING(str)->as.heap.aux.shared = add;
    }
    @@ -780,6 +781,7 @@ rb_str_associated(VALUE str)
    {
    if (STR_ASSOC_P(str)) {
  • if (OBJ_FROZEN(str)) return Qfalse;
  • return RSTRING(str)->as.heap.aux.shared;
  • VALUE ary = RSTRING(str)->as.heap.aux.shared;
  • if (OBJ_FROZEN(str)) OBJ_FREEZE(ary);
  • return ary;
    }
    return Qfalse;
    @@ -954,4 +956,8 @@ VALUE
    rb_str_freeze(VALUE str)
    {
  • if (STR_ASSOC_P(str)) {
  • VALUE ary = RSTRING(str)->as.heap.aux.shared;
  • OBJ_FREEZE(ary);
  • }
    return rb_obj_freeze(str);
    }

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33282] fronzen string cannot unpack(“p”)”
on Wed, 23 Jan 2008 02:07:00 +0900, Nobuyoshi N.
[email protected] writes:

|1.9e$B$G!"e(Bpack(“p”)e$B$7$F$G$-$?e(BStringe$B$re(Bfreezee$B$9$k$H!"e(Bunpacke$B$G$-$J$/$Je(B
|e$B$j$^$9!#e(B1.8e$B$G$O$G$-$^$9!#e(B

e$BI{:nMQ$,$"$j$=$&[email protected]$G$9$,!"$I$&LdBj$,$"$k$N$+3N?.$,$J$$$Ne(B
e$B$GC1$J$kIT0B$J$s$G$7$g$&!#%3%_%C%H$7$F$/[email protected]$5$$!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs