Issue #22284 has been reported by YO4 (Yoshinao Muramatsu). ---------------------------------------- Bug #22284: Passing an object with to_int to curry as its arity causes problems with LLP64. https://bugs.ruby-lang.org/issues/22284 * Author: YO4 (Yoshinao Muramatsu) * Status: Open * ruby -v: master * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- The proc_curry function in proc.c is affected by differences in behavior caused by the int size in FIX2INT. As a result, depending on the arguments, curry may not function correctly on Windows. ``` method(:puts).curry(1r).call(42) => #<Proc:0x0000000005e06c58 (lambda)> (Windows) => 42 (others) ``` The same thing happens in gems/src/rbs/test/stdlib/Proc_test.rb:113. It also triggers an assertion in a debug build on windows. ``` irb(main):001> method(:puts).curry(1r).call(42) S:\git\ruby\ruby\include\ruby/internal/arithmetic/long.h:192: Assertion Failed: rbimpl_fix2long_by_shift:RB_FIXNUM_P(x) ...(snip) -- C level backtrace information ------------------------------------------- C:\WINDOWS\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0x14) [0x00007FF82F2E0404] C:\WINDOWS\System32\KERNELBASE.dll(WaitForSingleObjectEx+0xaf) [0x00007FF82C53C11F] S:\git\ruby\mswin64\x64-vcruntime140-ruby410.dll(rb_print_backtrace+0x3e) [0x00007FFF45D706CA] S:\git\ruby\ruby\vm_dump.c:1137 S:\git\ruby\mswin64\x64-vcruntime140-ruby410.dll(rb_vm_bugreport+0x288) [0x00007FFF45D70958] S:\git\ruby\ruby\vm_dump.c:1482 S:\git\ruby\mswin64\x64-vcruntime140-ruby410.dll(rb_assert_failure_detail+0xbb) [0x00007FFF45C05557] S:\git\ruby\ruby\error.c:1227 S:\git\ruby\mswin64\x64-vcruntime140-ruby410.dll(rb_assert_failure+0x12) [0x00007FFF45C0549A] S:\git\ruby\ruby\error.c:1202 S:\git\ruby\mswin64\x64-vcruntime140-ruby410.dll(proc_curry+0xfa) [0x00007FFF45D48426] S:\git\ruby\ruby\proc.c:4614 ...(snip) ``` proc.c:4614 has this ``` sarity = FIX2INT(arity); ``` FIX2INT is being used, and based on what I've read in doc/extension.rdoc, I'm not entirely sure if it's correct for curry to use to_int. So just reporting this for now before submitting a PR. -- https://bugs.ruby-lang.org/