[Bug:1.8] superclass of singleton class in 1.8

e$B1sF#$G$9!#e(B

http://d.hatena.ne.jp/sumim/20080913/p1

e$B$N:G8e$G;XE&$5$l$F$$$k$3$H$G$9$,!"e(B1.8 e$B$N7Q>54X78$,$*$+$7$$$He(B
e$B;W$$$^$9!#e(B
Kernel e$B$Oe(B Module e$B$N%$%s%9%?%s%9$J$N$G!“e(BKernel
e$B$NFC0[%/%i%9$Ne(B
superclass e$B$Oe(B Module e$B$K$J$k$3$H$r4|BT$7$^$9$,!”:#$Ne(B 1.8
e$B$Oe(B
Module e$B$NFC0[%/%i%9$,e(B superclass e$B$K$J$C$F$$$^$9!#e(B

1.8 e$B$,$3$&$J$C$?7P0^$Oe(B [ruby-dev:23690] e$B$de(B [ruby-list:40520]
e$B$Ne(B
e$B$h$&$G$9!#e(B
e$B$3$NOC$N$b$H$b$H$NLdBj$Oe(B [ruby-list:40525]
e$B$K$"$j$^$9$,!“FC0[e(B
e$B%/%i%9$Oe(B Class e$B$N%$%s%9%?%s%9$G$”$C$F!"e(BClass
e$B$N%5%V%/%i%9$8$ce(B
e$B$J$$$N$OIT;W5D$J$3$H$G$O$J$$$G$9!#Nc$($P!"2?$+$N%*%V%8%’%/%H$,e(B
Object e$B$N%5%V%/%i%9$8$c$J$/$F$bIT;W5D$8$c$J$$$G$9!#e(B

e$B$^$?!"$3$N%W%m%0%i%`$GDj5A$5$l$?%a%=%C%I$O!“8F$S=P$7$F$be(B
bind argument must be an instance of Class (TypeError)
[email protected]$1$G$9!#e(B
e$B%b%8%e!<%ke(B Foo e$B$re(B self e$B$H$7$Fe(B Class#allocate
e$B$r<B9T$7$h$&$He(B
e$B$7$F$$$k$N$G!”@5>o$JNc30$G$9!#e(B

e$B$D$^$j$b$H$b$H$NLdBj$N%W%m%0%i%`$O!"DL$k$h$&$K$9$kM}M3$,$J$$e(B
e$B$H;W$$$^$9!#e(B

[email protected]!"$3$NOC$Oe(B define_method
e$B$N;~$K7?%A%’%C%/$9$k$h$&$K$J$C$?e(B
1.9 [email protected]$1$G5/$-$k8=>][email protected]$H;W$&$N$G$9$,!"$J$<$+%Q%C%A$Oe(B 1.8
[email protected]$1$Ke(B
e$BF~$C$F$$$^$9!#e(B2005 e$BG/Ev;~$O>u67$,0c$C$?$N$+$b$7$l$^$;$s$,!#e(B

e$B0J>e$h$j!"e(B1.8 e$B$+$iLdBj$N%Q%C%A$r$O$:$7$?J}$,$$$$$H;W$$$^$9!#e(B
e$B$I$&$G$7$g$&$+!#e(B

Index: object.c

— object.c (revision 19361)
+++ object.c (working copy)
@@ -1363,11 +1363,6 @@
rb_raise(rb_eTypeError, “compared with non class/module”);
}

  • if (FL_TEST(mod, FL_SINGLETON)) {
  • if (RCLASS(mod)->m_tbl == RCLASS(arg)->m_tbl)
  •  return Qtrue;
    
  • mod = RBASIC(mod)->klass;
  • }
    while (mod) {
    if (RCLASS(mod)->m_tbl == RCLASS(arg)->m_tbl)
    return Qtrue;
    @@ -1674,9 +1669,6 @@
    if (!super) {
    rb_raise(rb_eTypeError, “uninitialized class”);
    }
  • if (FL_TEST(klass, FL_SINGLETON)) {
  • super = RBASIC(klass)->klass;
  • }
    while (TYPE(super) == T_ICLASS) {
    super = RCLASS(super)->super;
    }