[#26132] [BUG] Hash#hash on 1.9 — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
3 messages
2005/05/08
[#26135] 1.8.3 preview1 ready? — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
12 messages
2005/05/11
[#26136] Re: 1.8.3 preview1 ready?
— nobu@...
2005/05/11
なかだです。
[#26140] DateとSOAPの型のマッピング — Shugo Maeda <shugo@...>
前田です。
5 messages
2005/05/11
[#26156] ruby 1.8.3 preview1 — Yukihiro Matsumoto <matz@...>
Hi,
28 messages
2005/05/12
[#26157] Re: ruby 1.8.3 preview1
— Tanaka Akira <akr@...17n.org>
2005/05/12
In article <1115887767.493637.3310.nullmailer@x31.priv.netlab.jp>,
[#26161] Re: ruby 1.8.3 preview1
— Yukihiro Matsumoto <matz@...>
2005/05/14
まつもと ゆきひろです
[#26185] Re: ruby 1.8.3 preview1
— とみたまさひろ <tommy@...>
2005/05/18
とみたです。
[#26193] Re: ruby 1.8.3 preview1
— 小西 弘将 <konishih@...6.so-net.ne.jp>
2005/05/20
小西 弘将です。
[#26164] error.c 1.108 — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
11 messages
2005/05/15
[#26177] autobuild failure: test_exception_subclass(SOAP::Marshal::TestMarshal) — Kazuhiro NISHIYAMA <zn@...>
西山和広です。
4 messages
2005/05/17
[#26186] ruby_setenv dumps core with mod_ruby/1.4.2 — Tietew <tietew-ml-ruby-dev@...>
Tietew です。
15 messages
2005/05/18
[#26285] Re: ruby_setenv dumps core with mod_ruby/1.4.2
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2005/06/05
山本です。
[#26325] Re: ruby_setenv dumps core with mod_ruby/1.4.2
— Tietew <tietew-ml-ruby-dev@...>
2005/06/10
Tietew です。
[#26327] Re: ruby_setenv dumps core with mod_ruby/1.4.2
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2005/06/10
山本です。
[#26328] Re: ruby_setenv dumps core with mod_ruby/1.4.2
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2005/06/10
山本です。
[#26338] Re: ruby_setenv dumps core with mod_ruby/1.4.2
— nobu@...
2005/06/12
なかだです。
[#26187] IO.select dumps core — Tanaka Akira <akr@...17n.org>
[ruby-talk:142505] で可能性に気がついたのですが、いま実験してみたとこ
31 messages
2005/05/18
[#26255] Re: IO.select dumps core
— nobu@...
2005/05/31
なかだです。
[#26256] Re: IO.select dumps core
— Tanaka Akira <akr@...17n.org>
2005/06/01
In article <200505311523.j4VFN4Y4005876@sharui.nakada.niregi.kanuma.tochigi.jp>,
[#26257] Re: IO.select dumps core
— nobu@...
2005/06/01
なかだです。
[#26262] Re: IO.select dumps core
— Tanaka Akira <akr@...17n.org>
2005/06/01
In article <200506010140.j511edY4012889@sharui.nakada.niregi.kanuma.tochigi.jp>,
[#26263] Re: IO.select dumps core
— nobu@...
2005/06/01
なかだです。
[#26265] Re: IO.select dumps core
— Takahiro Kambe <taca@...>
2005/06/02
In message <87u0khj377.fsf@m17n.org>
[#26365] Re: IO.select dumps core
— とみたまさひろ <tommy@...>
2005/06/22
とみたです。
[#26366] Re: IO.select dumps core
— nobu@...
2005/06/22
なかだです。
[#26369] Re: IO.select dumps core
— とみたまさひろ <tommy@...>
2005/06/23
とみたです。
[#26374] Re: IO.select dumps core
— Tanaka Akira <akr@...17n.org>
2005/06/24
In article <20050623125927.33401bc8.tommy@tmtm.org>,
[#26377] Re: IO.select dumps core
— とみたまさひろ <tommy@...>
2005/06/24
とみたです。
[#26394] Re: IO.select dumps core
— Tanaka Akira <akr@...17n.org>
2005/06/28
In article <20050625022017.706b0747.tommy@tmtm.org>,
[#26210] test_calc2(SOAP::Calc::TestCalc2): NoMethodError: undefined method `[]' for #<Set:0x41198fa8> — Tanaka Akira <akr@...17n.org>
そうそう、書くのをわすれていましたが、
4 messages
2005/05/23
[#26223] serious bug on Ruby/Tk — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
8 messages
2005/05/25
[#26242] many errors with soap/wsdl test on mswin32 — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
12 messages
2005/05/27
[#26249] Re: many errors with soap/wsdl test on mswin32
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2005/05/31
山本です。
[#26251] Re: many errors with soap/wsdl test on mswin32
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2005/05/31
山本です。
[#26260] Re: many errors with soap/wsdl test on mswin32
— "U.Nakamura" <usa@...>
2005/06/01
こんにちは、なかむら(う)です。
[#26282] Re: many errors with soap/wsdl test on mswin32
— "NAKAMURA, Hiroshi" <nakahiro@...>
2005/06/05
-----BEGIN PGP SIGNED MESSAGE-----
[#26283] Re: many errors with soap/wsdl test on mswin32
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2005/06/05
山本です。
[#26286] Re: many errors with soap/wsdl test on mswin32
— "NAKAMURA, Hiroshi" <nakahiro@...>
2005/06/05
05/06/05 に H. Yamamoto<ocean@m2.ccsnet.ne.jp> さんは書きました:
[ruby-dev:26132] [BUG] Hash#hash on 1.9
From:
"H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Date:
2005-05-08 11:11:18 UTC
List:
ruby-dev #26132
山本です。
Hash#hash の結果が、中身が等しいにもかかわらず
違う値になることがあります。
/////////////////////////////
// コード
a = {1=>nil, 2=>nil, []=>nil, {}=>nil, 5=>nil}
b = a.clone
p a
p b
p a.hash
p b.hash
p a.eql?(b)
/////////////////////////////
// 結果
{5=>nil, []=>nil, 1=>nil, {}=>nil, 2=>nil}
{[]=>nil, 5=>nil, 1=>nil, {}=>nil, 2=>nil}
3640
10552
true
これは、Hash の格納順が不定だからです。Hash#hash を求めるたびに
配列を確保するのもどうかと思ったのですが、下のパッチで一応動きます。
Index: hash.c
===================================================================
RCS file: /src/ruby/hash.c,v
retrieving revision 1.149
diff -u -w -b -p -r1.149 hash.c
--- hash.c 5 May 2005 23:08:47 -0000 1.149
+++ hash.c 8 May 2005 10:52:10 -0000
@@ -1497,21 +1497,11 @@ rb_hash_eql(hash1, hash2)
}
static int
-rb_hash_hash_i(key, value, hp)
- VALUE key, value;
- long *hp;
+rb_hash_hash_i(key, value, a)
+ VALUE key, value, a;
{
- long h = *hp;
- VALUE n;
-
- h = (h << 1) | (h<0 ? 1 : 0);
- n = rb_hash(key);
- h ^= NUM2LONG(n);
- h = (h << 1) | (h<0 ? 1 : 0);
- n = rb_hash(value);
- h ^= NUM2LONG(n);
-
- *hp = h;
+ rb_ary_push(a, rb_hash(key));
+ rb_ary_push(a, rb_hash(value));
return ST_CONTINUE;
}
@@ -1520,14 +1510,21 @@ recursive_hash(hash, dummy, recur)
VALUE hash, dummy;
int recur;
{
- long h;
- VALUE n;
+ long h, i;
+ VALUE n, a;
if (recur) {
return LONG2FIX(0);
}
h = RHASH(hash)->tbl->num_entries;
- rb_hash_foreach(hash, rb_hash_hash_i, (VALUE)&h);
+ a = rb_ary_new2(h*2);
+ rb_hash_foreach(hash, rb_hash_hash_i, a);
+ rb_ary_sort_bang(a);
+ for (i = 0; i < RARRAY(a)->len; i++) {
+ h = (h << 1) | (h<0 ? 1 : 0);
+ n = RARRAY(a)->ptr[i];
+ h ^= NUM2LONG(n);
+ }
h = (h << 1) | (h<0 ? 1 : 0);
n = rb_hash(RHASH(hash)->ifnone);
h ^= NUM2LONG(n);
//////////////////////////////////////////////
// パッチ後
{5=>nil, []=>nil, 1=>nil, {}=>nil, 2=>nil}
{[]=>nil, 5=>nil, 1=>nil, {}=>nil, 2=>nil}
10726
10726
true