Skip to content

Commit 238d596

Browse files
committed
Raise the same error as CRuby when rb_define_method argc is invalid
1 parent cbdd65f commit 238d596

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/truffle/truffle/cext_ruby.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ module Truffle::CExt
1515
# methods defined with rb_define_method are normal Ruby methods therefore they cannot be defined in the cext.rb file
1616
# file because blocks passed as arguments would be skipped by org.truffleruby.cext.CExtNodes.BlockProcNode
1717
def rb_define_method(mod, name, function, argc)
18-
if argc < -2
19-
raise "Unsupported rb_define_method argc: #{argc}"
18+
if argc < -2 or 15 < argc
19+
raise ArgumentError, "arity out of range: #{argc} for -2..15"
2020
end
2121

2222
method_body = Truffle::Graal.copy_captured_locals -> *args, &block do

0 commit comments

Comments
 (0)