From: naruse@... Date: 2020-03-13T14:26:43+00:00 Subject: [ruby-core:97483] [Ruby master Bug#16634] DRb remote method call with keyword argument occurs warning message of deprecated on Ruby 2.7.0, and fails on Ruby 2.8.0dev Issue #16634 has been updated by naruse (Yui NARUSE). Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ruby_2_7 2339be74e737b4c5f5330f845af2e7db0c7450e1. ---------------------------------------- Bug #16634: DRb remote method call with keyword argument occurs warning message of deprecated on Ruby 2.7.0, and fails on Ruby 2.8.0dev https://bugs.ruby-lang.org/issues/16634#change-84631 * Author: TOKI.Yoshinori (������ ������) * Status: Closed * Priority: Normal * ruby -v: ruby 2.8.0dev (2020-02-14 master 78282d4655) [x86_64-linux] * Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ---------------------------------------- DRb remote method call with keyword argument occurs warning message of deprecated on Ruby 2.7.0, and fails on Ruby 2.8.0dev On Ruby 2.7.0 (`ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]`), DRb remote method call with keyword argument occurs warning message of deprecated. On Ruby snapshot (`ruby 2.8.0dev (2020-02-14 master 78282d4655) [x86_64-linux]`), DRb remote method call with keyword argument fails. Test Script: ```ruby #!/usr/bin/env ruby require 'drb' require 'securerandom' require 'test/unit' def make_drbunix_uri "drbunix:/tmp/#{File.basename($0, '.rb')}.#{SecureRandom.uuid}" end DRb.start_service(make_drbunix_uri) class DRbRemoteMethodCallTest < Test::Unit::TestCase class Example def ping :pong end def foo(test: 'default') test end def bar(test: 'default') yield(test) end end def wait_server(remote_object) begin remote_object.ping rescue DRb::DRbConnError sleep(0.1) retry end end def setup @uri = make_drbunix_uri @pid = fork{ DRb.start_service(@uri, Example.new) DRb.thread.join } @remote_object = DRbObject.new_with_uri(@uri) wait_server(@remote_object) end def teardown Process.kill(:TERM, @pid) Process.wait end test 'pass keyword argument to remote method call' do assert_equal('halo', @remote_object.foo(test: 'halo')) end test 'pass keyword argument to remote method call with block' do assert_equal('halo', @remote_object.bar(test: 'halo') {|t| t }) end end ``` Output (`ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]`): ``` $ ruby test_drb_kw_args.rb -v Loaded suite test_drb_kw_args Started DRbRemoteMethodCallTest: test: pass keyword argument to remote method call: /usr/local/lib/ruby/2.7.0/drb/drb.rb:1690: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call test_drb_kw_args.rb:19: warning: The called method `foo' is defined here .: (0.115401) test: pass keyword argument to remote method call with block: /usr/local/lib/ruby/2.7.0/drb/invokemethod.rb:15: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call test_drb_kw_args.rb:23: warning: The called method `bar' is defined here .: (0.114446) Finished in 0.2303479 seconds. ------------------------------------------------------------------------------------------------------------------------------------------------------ 2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed ------------------------------------------------------------------------------------------------------------------------------------------------------ 8.68 tests/s, 8.68 assertions/s ``` Output (`ruby 2.8.0dev (2020-02-14 master 78282d4655) [x86_64-linux]`): ``` $ ruby test_drb_kw_args.rb -v Loaded suite test_drb_kw_args Started DRbRemoteMethodCallTest: test: pass keyword argument to remote method call: E ====================================================================================================================================================== test_drb_kw_args.rb:54:in `block in ' (drbunix:/tmp/test_drb_kw_args.f82f995e-265f-429c-a0fb-770e3fa8dd35) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1730:in `block in main_loop' (drbunix:/tmp/test_drb_kw_args.f82f995e-265f-429c-a0fb-770e3fa8dd35) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1730:in `loop' (drbunix:/tmp/test_drb_kw_args.f82f995e-265f-429c-a0fb-770e3fa8dd35) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1734:in `block (2 levels) in main_loop' (drbunix:/tmp/test_drb_kw_args.f82f995e-265f-429c-a0fb-770e3fa8dd35) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1646:in `perform' (drbunix:/tmp/test_drb_kw_args.f82f995e-265f-429c-a0fb-770e3fa8dd35) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1690:in `perform_without_block' (drbunix:/tmp/test_drb_kw_args.f82f995e-265f-429c-a0fb-770e3fa8dd35) test_drb_kw_args.rb:19:in `foo' Error: test: pass keyword argument to remote method call(DRbRemoteMethodCallTest): ArgumentError: wrong number of arguments (given 1, expected 0) ====================================================================================================================================================== : (0.021710) test: pass keyword argument to remote method call with block: E ====================================================================================================================================================== test_drb_kw_args.rb:58:in `block in ' (drbunix:/tmp/test_drb_kw_args.cdf13d27-0876-4ebb-ae7d-b5a79c6b58b8) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1730:in `block in main_loop' (drbunix:/tmp/test_drb_kw_args.cdf13d27-0876-4ebb-ae7d-b5a79c6b58b8) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1730:in `loop' (drbunix:/tmp/test_drb_kw_args.cdf13d27-0876-4ebb-ae7d-b5a79c6b58b8) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1734:in `block (2 levels) in main_loop' (drbunix:/tmp/test_drb_kw_args.cdf13d27-0876-4ebb-ae7d-b5a79c6b58b8) /usr/local/lib/ruby/2.8.0/drb/drb.rb:1644:in `perform' (drbunix:/tmp/test_drb_kw_args.cdf13d27-0876-4ebb-ae7d-b5a79c6b58b8) /usr/local/lib/ruby/2.8.0/drb/invokemethod.rb:15:in `perform_with_block' (drbunix:/tmp/test_drb_kw_args.cdf13d27-0876-4ebb-ae7d-b5a79c6b58b8) test_drb_kw_args.rb:23:in `bar' Error: test: pass keyword argument to remote method call with block(DRbRemoteMethodCallTest): ArgumentError: wrong number of arguments (given 1, expected 0) ====================================================================================================================================================== : (0.009290) Finished in 0.031537836 seconds. ------------------------------------------------------------------------------------------------------------------------------------------------------ 2 tests, 0 assertions, 0 failures, 2 errors, 0 pendings, 0 omissions, 0 notifications 0% passed ------------------------------------------------------------------------------------------------------------------------------------------------------ 63.42 tests/s, 0.00 assertions/s ``` Expected Output (`ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]`): ``` $ ruby test_drb_kw_args.rb -v Loaded suite test_drb_kw_args Started DRbRemoteMethodCallTest: test: pass keyword argument to remote method call: .: (0.107467) test: pass keyword argument to remote method call with block: .: (0.109916) Finished in 0.221072125 seconds. ------------------------------------------------------------------------------------------------------------------------------------------------------ 2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed ------------------------------------------------------------------------------------------------------------------------------------------------------ 9.05 tests/s, 9.05 assertions/s ``` -- https://bugs.ruby-lang.org/ Unsubscribe: