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