ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "hsbt (Hiroshi SHIBATA)" <shibata.hiroshi@gmail•com>
To: ruby-dev@ruby-lang.org (ruby developers list)
Subject: [ruby-dev:46470] [ruby-trunk - Bug #7300] Hash#[] の挙動が 1.9.3 と異なっている
Date: Sat, 10 Nov 2012 07:43:54 +0900	[thread overview]
Message-ID: <redmine.journal-32725.20121110074347@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-7300.20121107170510@ruby-lang.org


Issue #7300 has been updated by hsbt (Hiroshi SHIBATA).


redis-rb という ruby から redis を扱うライブラリにも同じコードがありました。

https://github.com/redis/redis-rb/blob/master/lib/redis.rb#L182

redis-rb では [nil, ["redis_version", "2.6.4"], ...] というような配列を Hash[] に渡して初期化しようとして落ちています。
配列が nil だけの時の [nil, nil, ...] に加えて [nil, ["valid", "valid"], ...] みたいな一部だけ nil というような配列の時でも警告をして通すような変更だと助かります。
----------------------------------------
Bug #7300: Hash#[] の挙動が 1.9.3 と異なっている
https://bugs.ruby-lang.org/issues/7300#change-32725

Author: hsbt (Hiroshi SHIBATA)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07) [x86_64-darwin12.2.0]


Hash[[nil]] を実行すると 1.9.3 では {} となるものが 2.0.0 では ArgumentError となります。

なかださんに相談してみたら、2.0.0 の動きが不正なものをチェックしてて正しい挙動と
いうことを教えてもらいましたが、2.0.0 では duplicate の警告だけにして、
次のリリースで消すという方が良さそうに思います。


-- 
http://bugs.ruby-lang.org/

  parent reply	other threads:[~2012-11-09 22:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-07  8:05 [ruby-dev:46440] [ruby-trunk - Bug #7300][Open] Hash#[] の挙動が 1.9.3 と異なっている hsbt (Hiroshi SHIBATA)
2012-11-07  9:02 ` [ruby-dev:46441] [ruby-trunk - Bug #7300] " knu (Akinori MUSHA)
2012-11-07  9:04 ` [ruby-dev:46442] " knu (Akinori MUSHA)
2012-11-07 13:51 ` [ruby-dev:46446] " hsbt (Hiroshi SHIBATA)
2012-11-07 14:09 ` [ruby-dev:46447] [ruby-trunk - Bug #7300][Assigned] " mame (Yusuke Endoh)
2012-11-07 21:45 ` [ruby-dev:46449] [ruby-trunk - Bug #7300] " hsbt (Hiroshi SHIBATA)
2012-11-09 14:36 ` [ruby-dev:46464] " nobu (Nobuyoshi Nakada)
2012-11-09 14:45 ` [ruby-dev:46465] " nobu (Nobuyoshi Nakada)
2012-11-09 22:43 ` hsbt (Hiroshi SHIBATA) [this message]
2018-12-26  8:07 ` [ruby-dev:50731] [Ruby trunk Bug#7300][Open] " mame
2019-03-20  1:30 ` [ruby-dev:50783] [Ruby trunk Bug#7300] " hsbt
2019-05-22  7:10 ` [ruby-dev:50788] " nobu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-32725.20121110074347@ruby-lang.org \
    --to=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).