ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:105626] [Ruby master Bug#18250] Anonymous variables seem to break `Ractor.make_shareable`
@ 2021-10-12 23:43 tenderlovemaking (Aaron Patterson)
  2021-10-13  2:21 ` [ruby-core:105627] " nobu (Nobuyoshi Nakada)
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: tenderlovemaking (Aaron Patterson) @ 2021-10-12 23:43 UTC (permalink / raw)
  To: ruby-core

Issue #18250 has been reported by tenderlovemaking (Aaron Patterson).

----------------------------------------
Bug #18250: Anonymous variables seem to break `Ractor.make_shareable`
https://bugs.ruby-lang.org/issues/18250

* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* 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
<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 (2.58 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-03-12  5:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 23:43 [ruby-core:105626] [Ruby master Bug#18250] Anonymous variables seem to break `Ractor.make_shareable` tenderlovemaking (Aaron Patterson)
2021-10-13  2:21 ` [ruby-core:105627] " nobu (Nobuyoshi Nakada)
2021-10-13  7:46 ` [ruby-core:105629] " nobu (Nobuyoshi Nakada)
2021-11-12 16:47 ` [ruby-core:106037] " byroot (Jean Boussier)
2021-11-22  6:23 ` [ruby-core:106198] " nobu (Nobuyoshi Nakada)
2021-11-22 10:07 ` [ruby-core:106204] " byroot (Jean Boussier)
2021-11-22 11:16 ` [ruby-core:106205] " byroot (Jean Boussier)
2021-11-22 11:22 ` [ruby-core:106206] " byroot (Jean Boussier)
2021-11-24 14:57 ` [ruby-core:106265] " byroot (Jean Boussier)
2021-11-25  1:19 ` [ruby-core:106269] " nagachika (Tomoyuki Chikanaga)
2021-11-25  8:33 ` [ruby-core:106275] " byroot (Jean Boussier)
2021-11-26 16:46 ` [ruby-core:106292] " byroot (Jean Boussier)
2021-11-26 16:54 ` [ruby-core:106293] " byroot (Jean Boussier)
2022-03-12  5:29 ` [ruby-core:107851] " nagachika (Tomoyuki Chikanaga)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).