From: "byroot (Jean Boussier)" Date: 2021-11-24T14:57:31+00:00 Subject: [ruby-core:106265] [Ruby master Bug#18250] Anonymous variables seem to break `Ractor.make_shareable` Issue #18250 has been updated by byroot (Jean Boussier). This bug made it to the recently released ruby 3.0.3: https://github.com/Shopify/bootsnap/issues/378#issuecomment-977949971 Seems like the fix wasn't backported. ---------------------------------------- Bug #18250: Anonymous variables seem to break `Ractor.make_shareable` https://bugs.ruby-lang.org/issues/18250#change-94886 * Author: tenderlovemaking (Aaron Patterson) * Status: Closed * Priority: Normal * ruby -v: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- The following code breaks with a strange error: ```ruby def foo(*); ->{ super };end Ractor.make_shareable(foo) # expected Symbol ``` Output: ``` [aaron@tc ~/g/ruby (master)]$ cat test.rb def foo(*); ->{ super };end Ractor.make_shareable(foo) # expected Symbol [aaron@tc ~/g/ruby (master)]$ ruby test.rb :816:in `make_shareable': wrong argument type false (expected Symbol) (TypeError) from test.rb:2:in `
' [aaron@tc ~/g/ruby (master)]$ ``` The reason is because the `*` parameter has no name, but Ractor tries to find the name so it can make an exception. I *expect* the above program to raise an `Ractor::IsolationError`, but instead it raises a `TypeError`. I've attached a patch that fixes this bug. ---Files-------------------------------- 0001-Give-params-a-name.patch (3.33 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: