From: KUBO Takehiro Date: 2007-12-30T13:15:19+09:00 Subject: Re: Using "sort!" in a C extension (1.9 problem) On Dec 30, 2007 12:11 PM, Andre Nathan wrote: > On Sun, 2007-12-30 at 11:36 +0900, Andre Nathan wrote: > > On Sun, 2007-12-30 at 10:59 +0900, KUBO Takehiro wrote: > > > Use rb_ary_sort_bang instead of call_sort_bang. > > > I don't know why call_sort_bang doesn't work. Sorry. This is my mistake. > but that has the same problem I had with rb_funcall -- sort_by_length is > given the current array element only as its argument. How about the following patch to ruby svn trunk? --- vm_insnhelper.c (revision 14790) +++ vm_insnhelper.c (working copy) @@ -652,9 +652,12 @@ else if (argc == 0) { arg = Qnil; } - else { + else if (argc == 1) { arg = argv[0]; } + else { + arg = rb_ary_new4(argc, argv); + } vm_push_frame(th, 0, FRAME_MAGIC_IFUNC, self, (VALUE)block->dfp, I'm not certain this is a correct patch. But at least, sort_by_length works fine.