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