[前][次][番号順一覧][スレッド一覧]

ruby-changes:52979

From: hsbt <ko1@a...>
Date: Sat, 20 Oct 2018 13:25:10 +0900 (JST)
Subject: [ruby-changes:52979] hsbt:r65193 (trunk): Merge Pysch-3.1.0.pre2 from ruby/psych.

hsbt	2018-10-20 13:25:04 +0900 (Sat, 20 Oct 2018)

  New Revision: 65193

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65193

  Log:
    Merge Pysch-3.1.0.pre2 from ruby/psych.
    
      * Added deprecated warnings for the new interface of keyword argument.

  Modified files:
    trunk/ext/psych/lib/psych/versions.rb
    trunk/ext/psych/lib/psych.rb
    trunk/ext/psych/psych.gemspec
    trunk/test/psych/test_exception.rb
    trunk/test/psych/test_psych.rb
    trunk/test/psych/test_safe_load.rb
    trunk/test/psych/test_yaml_special_cases.rb
Index: test/psych/test_yaml_special_cases.rb
===================================================================
--- test/psych/test_yaml_special_cases.rb	(revision 65192)
+++ test/psych/test_yaml_special_cases.rb	(revision 65193)
@@ -17,7 +17,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_yaml_special_cases.rb#L17
       assert_equal [], Psych.load_stream(s)
       assert_equal false, Psych.parse(s)
       assert_equal [], Psych.parse_stream(s).transform
-      assert_equal nil, Psych.safe_load(s)
+      assert_nil   Psych.safe_load(s)
     end
 
     def test_false
@@ -49,11 +49,11 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_yaml_special_cases.rb#L49
 
     def test_inf
       s = "-.inf"
-      assert_equal -Float::INFINITY, Psych.load(s)
-      assert_equal [-Float::INFINITY], Psych.load_stream(s)
-      assert_equal -Float::INFINITY, Psych.parse(s).transform
-      assert_equal [-Float::INFINITY], Psych.parse_stream(s).transform
-      assert_equal -Float::INFINITY, Psych.safe_load(s)
+      assert_equal(-Float::INFINITY, Psych.load(s))
+      assert_equal([-Float::INFINITY], Psych.load_stream(s))
+      assert_equal(-Float::INFINITY, Psych.parse(s).transform)
+      assert_equal([-Float::INFINITY], Psych.parse_stream(s).transform)
+      assert_equal(-Float::INFINITY, Psych.safe_load(s))
     end
 
     def test_NaN
@@ -112,11 +112,11 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_yaml_special_cases.rb#L112
 
     def test_null
       s = "null"
-      assert_equal nil, Psych.load(s)
+      assert_nil   Psych.load(s)
       assert_equal [nil], Psych.load_stream(s)
-      assert_equal nil, Psych.parse(s).transform
+      assert_nil   Psych.parse(s).transform
       assert_equal [nil], Psych.parse_stream(s).transform
-      assert_equal nil, Psych.safe_load(s)
+      assert_nil   Psych.safe_load(s)
     end
 
     private
Index: test/psych/test_exception.rb
===================================================================
--- test/psych/test_exception.rb	(revision 65192)
+++ test/psych/test_exception.rb	(revision 65193)
@@ -15,6 +15,12 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_exception.rb#L15
     def setup
       super
       @wups = Wups.new
+
+      @orig_verbose, $VERBOSE = $VERBOSE, nil
+    end
+
+    def teardown
+      $VERBOSE = @orig_verbose
     end
 
     def test_naming_exception
Index: test/psych/test_safe_load.rb
===================================================================
--- test/psych/test_safe_load.rb	(revision 65192)
+++ test/psych/test_safe_load.rb	(revision 65193)
@@ -3,6 +3,14 @@ require 'psych/helper' https://github.com/ruby/ruby/blob/trunk/test/psych/test_safe_load.rb#L3
 
 module Psych
   class TestSafeLoad < TestCase
+    def setup
+      @orig_verbose, $VERBOSE = $VERBOSE, nil
+    end
+
+    def teardown
+      $VERBOSE = @orig_verbose
+    end
+
     class Foo; end
 
     [1, 2.2, {}, [], "foo"].each do |obj|
Index: test/psych/test_psych.rb
===================================================================
--- test/psych/test_psych.rb	(revision 65192)
+++ test/psych/test_psych.rb	(revision 65193)
@@ -5,8 +5,14 @@ require 'stringio' https://github.com/ruby/ruby/blob/trunk/test/psych/test_psych.rb#L5
 require 'tempfile'
 
 class TestPsych < Psych::TestCase
+
+  def setup
+    @orig_verbose, $VERBOSE = $VERBOSE, nil
+  end
+
   def teardown
     Psych.domain_types.clear
+    $VERBOSE = @orig_verbose
   end
 
   def test_line_width_invalid
Index: ext/psych/lib/psych/versions.rb
===================================================================
--- ext/psych/lib/psych/versions.rb	(revision 65192)
+++ ext/psych/lib/psych/versions.rb	(revision 65193)
@@ -1,9 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/versions.rb#L1
 # frozen_string_literal: true
 module Psych
-  # The version is Psych you're using
-  VERSION = '3.1.0.pre1' unless defined?(::Psych::VERSION)
+  # The version of Psych you are using
+  VERSION = '3.1.0.pre2' unless defined?(::Psych::VERSION)
 
   if RUBY_ENGINE == 'jruby'
-    DEFAULT_SNAKEYAML_VERSION = '1.21'.freeze
+    DEFAULT_SNAKEYAML_VERSION = '1.23'.freeze
   end
 end
Index: ext/psych/lib/psych.rb
===================================================================
--- ext/psych/lib/psych.rb	(revision 65192)
+++ ext/psych/lib/psych.rb	(revision 65193)
@@ -3,7 +3,12 @@ require 'psych/versions' https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L3
 case RUBY_ENGINE
 when 'jruby'
   require 'psych_jars'
-  org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
+  if JRuby::Util.respond_to?(:load_ext)
+    JRuby::Util.load_ext('org.jruby.ext.psych.PsychLibrary')
+  else
+    require 'java'; require 'jruby'
+    org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
+  end
 else
   begin
     require "#{RUBY_VERSION[/\d+\.\d+/]}/psych.so"
@@ -31,7 +36,7 @@ require 'psych/class_loader' https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L36
 # = Overview
 #
 # Psych is a YAML parser and emitter.
-# Psych leverages libyaml [Home page: http://pyyaml.org/wiki/LibYAML]
+# Psych leverages libyaml [Home page: https://pyyaml.org/wiki/LibYAML]
 # or [HG repo: https://bitbucket.org/xi/libyaml] for its YAML parsing
 # and emitting capabilities. In addition to wrapping libyaml, Psych also
 # knows how to serialize and de-serialize most Ruby objects to and from
@@ -265,6 +270,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L270
   #
   def self.load yaml, legacy_filename = NOT_GIVEN, filename: nil, fallback: false, symbolize_names: false
     if legacy_filename != NOT_GIVEN
+      warn 'warning: Passing filename with the 2nd argument of Psych.load is deprecated. Use keyword argument like Psych.load(yaml, filename: ...) instead.'
       filename = legacy_filename
     end
 
@@ -321,18 +327,22 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L327
   #
   def self.safe_load yaml, legacy_whitelist_classes = NOT_GIVEN, legacy_whitelist_symbols = NOT_GIVEN, legacy_aliases = NOT_GIVEN, legacy_filename = NOT_GIVEN, whitelist_classes: [], whitelist_symbols: [], aliases: false, filename: nil, fallback: nil, symbolize_names: false
     if legacy_whitelist_classes != NOT_GIVEN
+      warn 'warning: Passing whitelist_classes with the 2nd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, whitelist_classes: ...) instead.'
       whitelist_classes = legacy_whitelist_classes
     end
 
     if legacy_whitelist_symbols != NOT_GIVEN
+      warn 'warning: Passing whitelist_symbols with the 3rd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, whitelist_symbols: ...) instead.'
       whitelist_symbols = legacy_whitelist_symbols
     end
 
     if legacy_aliases != NOT_GIVEN
+      warn 'warning: Passing aliases with the 4th argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, aliases: ...) instead.'
       aliases = legacy_aliases
     end
 
     if legacy_filename != NOT_GIVEN
+      warn 'warning: Passing filename with the 5th argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, filename: ...) instead.'
       filename = legacy_filename
     end
 
@@ -373,6 +383,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L383
   # See Psych::Nodes for more information about YAML AST.
   def self.parse yaml, legacy_filename = NOT_GIVEN, filename: nil, fallback: NOT_GIVEN
     if legacy_filename != NOT_GIVEN
+      warn 'warning: Passing filename with the 2nd argument of Psych.parse is deprecated. Use keyword argument like Psych.parse(yaml, filename: ...) instead.'
       filename = legacy_filename
     end
 
@@ -381,6 +392,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L392
     end
 
     if fallback != NOT_GIVEN
+      warn 'warning: Passing the `fallback` keyword argument of Psych.parse is deprecated.'
       fallback
     else
       false
@@ -435,6 +447,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L447
   # See Psych::Nodes for more information about YAML AST.
   def self.parse_stream yaml, legacy_filename = NOT_GIVEN, filename: nil, &block
     if legacy_filename != NOT_GIVEN
+      warn 'warning: Passing filename with the 2nd argument of Psych.parse_stream is deprecated. Use keyword argument like Psych.parse_stream(yaml, filename: ...) instead.'
       filename = legacy_filename
     end
 
@@ -540,6 +553,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L553
   #
   def self.load_stream yaml, legacy_filename = NOT_GIVEN, filename: nil, fallback: []
     if legacy_filename != NOT_GIVEN
+      warn 'warning: Passing filename with the 2nd argument of Psych.load_stream is deprecated. Use keyword argument like Psych.load_stream(yaml, filename: ...) instead.'
       filename = legacy_filename
     end
 
Index: ext/psych/psych.gemspec
===================================================================
--- ext/psych/psych.gemspec	(revision 65192)
+++ ext/psych/psych.gemspec	(revision 65193)
@@ -4,6 +4,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.gemspec#L4
 begin
   require_relative 'lib/psych/versions'
 rescue LoadError
+  # for Ruby core repository
   require_relative 'versions'
 end
 
@@ -14,7 +15,7 @@ Gem::Specification.new do |s| https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.gemspec#L15
   s.email = ["aaron@t...", "hsbt@r...", "headius@h..."]
   s.summary = "Psych is a YAML parser and emitter"
   s.description = <<-DESCRIPTION
-Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
+Psych is a YAML parser and emitter. Psych leverages libyaml[https://pyyaml.org/wiki/LibYAML]
 for its YAML parsing and emitting capabilities. In addition to wrapping libyaml,
 Psych also knows how to serialize and de-serialize most Ruby objects to and from the YAML format.
 DESCRIPTION
@@ -64,6 +65,6 @@ DESCRIPTION https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.gemspec#L65
     s.add_development_dependency 'ruby-maven'
   else
     s.extensions = ["ext/psych/extconf.rb"]
-    s.add_development_dependency 'rake-compiler-dock', ">= 0.6.1"
+    s.add_development_dependency 'rake-compiler-dock', ">= 0.6.3"
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]