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