ruby-changes:30638
From: tenderlove <ko1@a...>
Date: Thu, 29 Aug 2013 02:42:46 +0900 (JST)
Subject: [ruby-changes:30638] tenderlove:r42717 (trunk): * ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be
tenderlove 2013-08-29 02:42:38 +0900 (Thu, 29 Aug 2013) New Revision: 42717 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42717 Log: * ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be treated as strings. [Fixes GH-156] https://github.com/tenderlove/psych/issues/156 * test/psych/test_string.rb: test for change Modified files: trunk/ChangeLog trunk/ext/psych/lib/psych/scalar_scanner.rb trunk/test/psych/test_string.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 42716) +++ ChangeLog (revision 42717) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Aug 29 02:40:45 2013 Aaron Patterson <aaron@t...> + + * ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be + treated as strings. + [Fixes GH-156] https://github.com/tenderlove/psych/issues/156 + + * test/psych/test_string.rb: test for change + Wed Aug 28 17:20:07 2013 Nobuyoshi Nakada <nobu@r...> * thread_pthread.c (hpux_attr_getstackaddr): basic support for the Index: ext/psych/lib/psych/scalar_scanner.rb =================================================================== --- ext/psych/lib/psych/scalar_scanner.rb (revision 42716) +++ ext/psych/lib/psych/scalar_scanner.rb (revision 42717) @@ -95,7 +95,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/scalar_scanner.rb#L95 end i when FLOAT - if string == '.' + if string =~ /\A[-+]?\.\Z/ @string_cache[string] = true string else Index: test/psych/test_string.rb =================================================================== --- test/psych/test_string.rb (revision 42716) +++ test/psych/test_string.rb (revision 42717) @@ -15,6 +15,11 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_string.rb#L15 end end + def test_dash_dot + assert_cycle '-.' + assert_cycle '+.' + end + def test_string_subclass_with_anchor y = Psych.load <<-eoyml --- -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/