Bug #14627
class_eval "def foo(N:)\n end" regression
Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
2.5.0
Description
Ruby crashes with a segfault in case of class_eval
defining method with a keyword starts with a capital letter. It seems like it's a regression of one of the latest versions.
Files
Related issues
History
Updated by nobu (Nobuyoshi Nakada) 11 months ago
I can't reproduce it.
$ ruby -v -e 'Class.new.class_eval "def foo(N:)\n end"' ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux-gnu] Traceback (most recent call last): 1: from -e:1:in `<main>' -e:1:in `class_eval': (eval):1: formal argument cannot be a constant (SyntaxError) def foo(N:) ^~ (eval):1: dynamic constant assignment def foo(N:) ^
Could you post simple code to reproduce and full message, in text format?
Updated by mame (Yusuke Endoh) 11 months ago
I could repro:
$ ruby -e 'Class.new.class_eval "def f(a:, N:)\nend"' -e:1: [BUG] Segmentation fault at 0x0000000000000028 ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux] *snip*
This [BUG] does not occur on trunk, so maybe it has been already fixed.
Updated by mrkn (Kenta Murata) 11 months ago
I cannot reproduce it on the HEAD of ruby_2_5:
$ ruby -ve 'Class.new.class_eval "def foo(a:, N:)\nend"' ruby 2.5.1p53 (2018-03-25 revision 62911) [x86_64-darwin16] Traceback (most recent call last): 1: from -e:1:in `<main>' -e:1:in `class_eval': (eval):1: formal argument cannot be a constant (SyntaxError) def foo(a:, N:) ^~ (eval):1: dynamic constant assignment def foo(a:, N:) ^
Updated by nobu (Nobuyoshi Nakada) 11 months ago
- Is duplicate of Bug #14261: invalid syntax segfaults: "x, true" added
Updated by naruse (Yui NARUSE) 11 months ago
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED