From 476a62fbbec0c8b7dafb74827447cfb4ebd7dd06 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Fri, 5 Apr 2013 17:55:53 +0000 Subject: [PATCH] * ext/psych/lib/psych/exception.rb: there should be only one exception base class. Fixes tenderlove/psych #125 * ext/psych/lib/psych.rb: require the correct exception class * ext/psych/lib/psych/syntax_error.rb: ditto * ext/psych/lib/psych/visitors/to_ruby.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ ext/psych/lib/psych.rb | 6 ------ ext/psych/lib/psych/exception.rb | 7 +++++++ ext/psych/lib/psych/syntax_error.rb | 7 +++---- ext/psych/lib/psych/visitors/to_ruby.rb | 1 + 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 ext/psych/lib/psych/exception.rb diff --git a/ChangeLog b/ChangeLog index f0dba22e9c27..304ecaba2854 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3666,6 +3666,14 @@ * gc.c: Improve accuracy of objspace_live_num() and allocated/freed counters. patched by tmm1(Aman Gupta). [Bug #8092] [ruby-core:53392] + +Sat Apr 6 02:54:08 2013 Aaron Patterson + + * ext/psych/lib/psych/exception.rb: there should be only one exception + base class. Fixes tenderlove/psych #125 + * ext/psych/lib/psych.rb: require the correct exception class + * ext/psych/lib/psych/syntax_error.rb: ditto + * ext/psych/lib/psych/visitors/to_ruby.rb: ditto Fri Apr 5 00:54:08 2013 NARUSE, Yui diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 3ca611748473..7d7d2bfb00f4 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -100,12 +100,6 @@ module Psych # The version of libyaml Psych is using LIBYAML_VERSION = Psych.libyaml_version.join '.' - class Exception < RuntimeError - end - - class BadAlias < Exception - end - ### # Load +yaml+ in to a Ruby data structure. If multiple documents are # provided, the object contained in the first document will be returned. diff --git a/ext/psych/lib/psych/exception.rb b/ext/psych/lib/psych/exception.rb new file mode 100644 index 000000000000..d96c527cfba7 --- /dev/null +++ b/ext/psych/lib/psych/exception.rb @@ -0,0 +1,7 @@ +module Psych + class Exception < RuntimeError + end + + class BadAlias < Exception + end +end diff --git a/ext/psych/lib/psych/syntax_error.rb b/ext/psych/lib/psych/syntax_error.rb index f972256f9e37..e200ef006067 100644 --- a/ext/psych/lib/psych/syntax_error.rb +++ b/ext/psych/lib/psych/syntax_error.rb @@ -1,8 +1,7 @@ -module Psych - class Error < RuntimeError - end +require 'psych/exception' - class SyntaxError < Error +module Psych + class SyntaxError < Psych::Exception attr_reader :file, :line, :column, :offset, :problem, :context def initialize file, line, col, offset, problem, context diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index b59bc3883070..75c7bc0c550a 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -1,4 +1,5 @@ require 'psych/scalar_scanner' +require 'psych/exception' unless defined?(Regexp::NOENCODING) Regexp::NOENCODING = 32