diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-24 07:51:05 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-24 07:51:05 +0000 |
commit | 96af5360a4089daf90743ad4722e77eff2261145 (patch) | |
tree | 1947bc517fbe570b95016009602ad3c3192f24d5 | |
parent | aab2f788d784ef73dd088f7cc6e258672da0ae59 (diff) | |
download | ruby-96af5360a4089daf90743ad4722e77eff2261145.tar.gz |
* enum.c (enum_zip): Fix error message
* array.c (take_items): Same, for Array#zip
[Bug #7706]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | array.c | 3 | ||||
-rw-r--r-- | enum.c | 5 |
3 files changed, 12 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Thu Jan 24 16:49:17 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca> + + * enum.c (enum_zip): Fix error message + + * array.c (take_items): Same, for Array#zip + Thu Jan 24 16:47:26 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca> * enumerator.c (lazy_zip): raise error for bad arguments @@ -3047,7 +3047,8 @@ take_items(VALUE obj, long n) result = rb_ary_new2(n); args[0] = result; args[1] = (VALUE)n; if (rb_check_block_call(obj, idEach, 0, 0, take_i, (VALUE)args) == Qundef) - Check_Type(obj, T_ARRAY); + rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)", + rb_obj_classname(obj)); return result; } @@ -2051,7 +2051,10 @@ enum_zip(int argc, VALUE *argv, VALUE obj) if (!allary) { CONST_ID(conv, "to_enum"); for (i=0; i<argc; i++) { - if (!rb_respond_to(argv[i], id_each)) Check_Type(argv[i], T_ARRAY); + if (!rb_respond_to(argv[i], id_each)) { + rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)", + rb_obj_classname(argv[i])); + } argv[i] = rb_funcall(argv[i], conv, 1, ID2SYM(id_each)); } } |