Bug #4234: Hash#default_proc=3D Doesn't Accept nil Argument
http://redmine.ruby-lang.org/issues/show/4234

Author: Run Paint Run Run
Status: Open, Priority: Low
Category: core
ruby -v: ruby 1.9.3dev (2011-01-05 trunk 30456) [x86_64-linux] =


The initial value of a Hash's default Proc is the block passed to Hash.ne=
w or nil. Hash#default_proc=3D can set the default Proc to a given Proc, =
but can't reset it to nil. This is unsymmetrical. =


The attached patch lets #default_proc=3D take a nil argument, and provide=
s tests. This causes a RubySpec failure ("Hash#default_proc=3D raises an =
error if passed stuff not convertible to procs"), which I will fix if thi=
s patch is applied.


----------------------------------------
http://redmine.ruby-lang.org
ZGlmZiAtLWdpdCBhL2hhc2guYyBiL2hhc2guYwppbmRleCBjNzY5ZTYwLi41
YzY4MGYyIDEwMDY0NAotLS0gYS9oYXNoLmMKKysrIGIvaGFzaC5jCkBAIC03
MDksNiArNzA5LDEzIEBAIHJiX2hhc2hfc2V0X2RlZmF1bHRfcHJvYyhWQUxV
RSBoYXNoLCBWQUxVRSBwcm9jKQogICAgIFZBTFVFIGI7CiAKICAgICByYl9o
YXNoX21vZGlmeShoYXNoKTsKKworICAgIGlmIChOSUxfUChwcm9jKSkgewor
CUZMX1VOU0VUKGhhc2gsIEhBU0hfUFJPQ19ERUZBVUxUKTsKKwlSSEFTSF9J
Rk5PTkUoaGFzaCkgPSBwcm9jOworCXJldHVybiBwcm9jOworICAgIH0KKwog
ICAgIGIgPSByYl9jaGVja19jb252ZXJ0X3R5cGUocHJvYywgVF9EQVRBLCAi
UHJvYyIsICJ0b19wcm9jIik7CiAgICAgaWYgKE5JTF9QKGIpIHx8ICFyYl9v
YmpfaXNfcHJvYyhiKSkgewogCXJiX3JhaXNlKHJiX2VUeXBlRXJyb3IsCmRp
ZmYgLS1naXQgYS90ZXN0L3J1YnkvdGVzdF9oYXNoLnJiIGIvdGVzdC9ydWJ5
L3Rlc3RfaGFzaC5yYgppbmRleCA3ODJlZGM5Li4yOWZjOTNkIDEwMDY0NAot
LS0g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