Project

General

Profile

Actions

Bug #18250

closed

Anonymous variables seem to break `Ractor.make_shareable`

Added by tenderlovemaking (Aaron Patterson) 4 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]
[ruby-core:105626]

Description

The following code breaks with a strange error:

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
<internal:ractor>:816:in `make_shareable': wrong argument type false (expected Symbol) (TypeError)
        from test.rb:2:in `<main>'
[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) 0001-Give-params-a-name.patch tenderlovemaking (Aaron Patterson), 10/13/2021 12:40 AM
Actions

Also available in: Atom PDF