summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ext/psych/parser.c2
-rw-r--r--test/psych/test_parser.rb15
-rw-r--r--version.h2
4 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 42e52ee0c2..9ae2ecdc82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Jan 22 11:21:40 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (parse): fixing off-by-one error on line numbers
+ in parse exceptions. [ruby-core:34690]
+
+ * test/psych/test_parser.rb: test for error
+
Wed Jan 19 13:04:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* proc.c (proc_call): Add gc guard to avoid segfault. The fix
diff --git a/ext/psych/parser.c b/ext/psych/parser.c
index 0fa02b981f..ca2946e200 100644
--- a/ext/psych/parser.c
+++ b/ext/psych/parser.c
@@ -75,7 +75,7 @@ static VALUE parse(VALUE self, VALUE yaml)
while(!done) {
if(!yaml_parser_parse(&parser, &event)) {
- size_t line = parser.mark.line;
+ size_t line = parser.mark.line + 1;
size_t column = parser.mark.column;
yaml_parser_delete(&parser);
diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb
index 9ef2a41e1d..6df474e620 100644
--- a/test/psych/test_parser.rb
+++ b/test/psych/test_parser.rb
@@ -46,6 +46,21 @@ module Psych
end
end
+ # ruby-core:34690
+ def test_exception_line
+ e = assert_raises(Psych::SyntaxError) do
+ @parser.parse(<<-eoyaml)
+# based on "SGML/XML character entity reference" at http://www.bitjungle.com/isoent/
+#
+---
+#DOUBLE LOW-9 QUOTATION MARK
+#requires fontenc:T1
+ldquor: ,,
+ eoyaml
+ end
+ assert_match 'line 6', e.message
+ end
+
def test_mapping_end
@parser.parse("---\n!!map { key: value }")
assert_called :end_mapping
diff --git a/version.h b/version.h
index 0e19924a23..6561988c3b 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 168
+#define RUBY_PATCHLEVEL 169
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1