summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-15 08:55:56 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-15 08:55:56 +0000
commit402906e265bf5eeb94d6de5db2246ca15c4746a7 (patch)
tree55b1c501769fc69c14b56fc21a7467805526a59d
parentda7dedecae53231a949e31af0b4d319b298e6ddf (diff)
merge revision(s) 66736: [Backport #15511]
ast.c: argument must be a string [ruby-core:90904] [Bug #15511] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ast.c2
-rw-r--r--test/ruby/test_ast.rb8
-rw-r--r--version.h2
3 files changed, 10 insertions, 2 deletions
diff --git a/ast.c b/ast.c
index c3f28eba0b..2df4bdd870 100644
--- a/ast.c
+++ b/ast.c
@@ -96,7 +96,7 @@ rb_ast_parse_str(VALUE str)
{
rb_ast_t *ast = 0;
- str = rb_check_string_type(str);
+ StringValue(str);
ast = rb_parser_compile_string_path(ast_parse_new(), Qnil, str, 1);
return ast_parse_done(ast);
}
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 055567d574..23cd5618a0 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -134,6 +134,14 @@ class TestAst < Test::Unit::TestCase
assert_raise(TypeError) {RubyVM::AbstractSyntaxTree::Node.allocate}
end
+ def test_parse_argument_error
+ assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(0)}
+ assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(nil)}
+ assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(false)}
+ assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(true)}
+ assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(:foo)}
+ end
+
def test_column_with_long_heredoc_identifier
term = "A"*257
ast = RubyVM::AbstractSyntaxTree.parse("<<-#{term}\n""ddddddd\n#{term}\n")
diff --git a/version.h b/version.h
index 8651698333..519289ce60 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.6.0"
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 11
+#define RUBY_PATCHLEVEL 12
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 1