From 3227143dc69af1493d12f0f75382dc735bd1cdc3 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 22 Sep 2008 23:27:33 +0000 Subject: * hash.c (env_aset): allow nil value to remove an entry. [ruby-dev:36465] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ hash.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 310e47dac..5eb77c987 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Sep 23 08:25:56 2008 Yukihiro Matsumoto + + * hash.c (env_aset): allow nil value to remove an entry. + [ruby-dev:36465] + Tue Sep 23 08:07:07 2008 Yukihiro Matsumoto * misc/ruby-mode.el (ruby-keyword-end-re): emacs21 support. a diff --git a/hash.c b/hash.c index 694b61952..bc627d868 100644 --- a/hash.c +++ b/hash.c @@ -2052,7 +2052,8 @@ env_aset(VALUE obj, VALUE nm, VALUE val) } if (NIL_P(val)) { - rb_raise(rb_eTypeError, "cannot assign nil; use Hash#delete instead"); + env_delete(obj, nm); + return Qnil; } StringValue(nm); StringValue(val); -- cgit