Actions
Bug #14627
closedclass_eval "def foo(N:)\n end" regression
Status:
Closed
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
Updated by ViugiNick (Nickolay Viuginov) almost 7 years ago
- ruby -v set to 2.5.0
Updated by nobu (Nobuyoshi Nakada) over 6 years 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 nobu (Nobuyoshi Nakada) over 6 years ago
- Status changed from Open to Feedback
Updated by mame (Yusuke Endoh) over 6 years 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) over 6 years 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) over 6 years ago
- Is duplicate of Bug #14261: invalid syntax segfaults: "x, true" added
Updated by nobu (Nobuyoshi Nakada) over 6 years ago
- Status changed from Feedback to Closed
Updated by naruse (Yui NARUSE) over 6 years ago
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0