summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb10
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f1c5858fc8..0e1de32cb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Oct 5 01:22:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: use normal begin / rescue
+ since postfix rescue cannot receive the exception class. Thanks
+ nagachika!
+
Tue Oct 4 21:10:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* class.c (class_alloc): allocate extra memory after containing
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index 3e8acbb21c..e390cbb16a 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -74,13 +74,19 @@ module Psych
end
i
when FLOAT
- return Float(string.gsub(/[,_]/, '')) rescue ArgumentError
+ begin
+ return Float(string.gsub(/[,_]/, ''))
+ rescue ArgumentError
+ end
@string_cache[string] = true
string
else
if string.count('.') < 2
- return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError
+ begin
+ return Integer(string.gsub(/[,_]/, ''))
+ rescue ArgumentError
+ end
end
@string_cache[string] = true