From 011347e4d71d9d6a706759b4a43687b87d77a97d Mon Sep 17 00:00:00 2001 From: normal Date: Tue, 7 Jul 2015 19:50:49 +0000 Subject: [PATCH] iseq.c (iseq_data_to_ary): dump kw_arg as symbol Fix RubyVM::InstructionSequence#to_a after r49517 Keywords were made symbols to fix [Bug #10831] [ruby-core:68031], so we should dump symbols as-is instead of attempting to convert them from IDs * iseq.c (iseq_data_to_ary): dump kw_arg as symbol * test/-ext-/iseq_load/test_iseq_load.rb: test kw_arg roundtrip [ruby-core:69891] [Bug #11338] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ iseq.c | 2 +- test/-ext-/iseq_load/test_iseq_load.rb | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2faa64d122..f0a5325b23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Jul 8 04:42:27 2015 Eric Wong + + * iseq.c (iseq_data_to_ary): dump kw_arg as symbol + * test/-ext-/iseq_load/test_iseq_load.rb: test kw_arg roundtrip + [ruby-core:69891] [Bug #11338] + Tue Jul 7 18:18:41 2015 Kazuhiro NISHIYAMA * random.c (fill_random_bytes_syscall): fix compile error. diff --git a/iseq.c b/iseq.c index cd7f67ac14..e8318b9233 100644 --- a/iseq.c +++ b/iseq.c @@ -1795,7 +1795,7 @@ iseq_data_to_ary(rb_iseq_t *iseq) orig_argc -= ci->kw_arg->keyword_len; for (i = 0; i < ci->kw_arg->keyword_len; i++) { - rb_ary_push(kw, ID2SYM(ci->kw_arg->keywords[i])); + rb_ary_push(kw, ci->kw_arg->keywords[i]); } rb_hash_aset(e, ID2SYM(rb_intern("kw_arg")), kw); } diff --git a/test/-ext-/iseq_load/test_iseq_load.rb b/test/-ext-/iseq_load/test_iseq_load.rb index 7251603b0a..5dfd69a863 100644 --- a/test/-ext-/iseq_load/test_iseq_load.rb +++ b/test/-ext-/iseq_load/test_iseq_load.rb @@ -86,6 +86,15 @@ class TestIseqLoad < Test::Unit::TestCase assert_iseq_roundtrip(src) end + def test_kwarg + assert_iseq_roundtrip <<-'end;' + def foo(kwarg: :foo) + kwarg + end + foo(kwarg: :bar) + end; + end + # FIXME: still failing def test_require_integration skip "iseq loader require integration tests still failing"