aboutsummaryrefslogtreecommitdiffstats
path: root/symbol.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-10-13 14:25:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-11-07 12:40:27 +0900
commit334b69e5042f47f89c8780c1d7efa32d70c84786 (patch)
tree6dccdd52ebecbb569c969c6fd4aacd595c4e1ded /symbol.c
parent66b0847602ffa47575371f4d5a9a04dc6013ba49 (diff)
downloadruby-334b69e5042f47f89c8780c1d7efa32d70c84786.tar.gz
rb_id_serial_to_id: return unregistered ID as an internal ID
```ruby def foo(*); ->{ super }; end ``` This code makes anonymous parameters which is not registered as an ID. The problem is that when Ractors try to scan `getlocal` instructions, it puts the Symbol corresponding to the parameter in to a hash. Since it is not registered, we end up with a strange exception. This commit wraps the unregistered ID in an internal ID so that we get the same exception for `...` as `*`. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: John Hawthorn <john@hawthorn.email>
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/symbol.c b/symbol.c
index 1b2a77c7c4..79ec4de502 100644
--- a/symbol.c
+++ b/symbol.c
@@ -486,7 +486,8 @@ rb_id_serial_to_id(rb_id_serial_t num)
{
if (is_notop_id((ID)num)) {
VALUE sym = get_id_serial_entry(num, 0, ID_ENTRY_SYM);
- return SYM2ID(sym);
+ if (sym) return SYM2ID(sym);
+ return ((ID)num << ID_SCOPE_SHIFT) | ID_INTERNAL | ID_STATIC_SYM;
}
else {
return (ID)num;