Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid spurious keyword argument warning on Ruby 2.7 #456

Merged
merged 1 commit into from May 28, 2022

Conversation

jeremyevans
Copy link
Contributor

There is no reason to use **kwargs in either of these methods,
as connect_start doesn't handle keywords (keywords passed to it
will be treated as a positional hash).

Fixes deprecation warning when using Sequel's postgres adapter in
Ruby 2.7.

There is no reason to use **kwargs in either of these methods,
as connect_start doesn't handle keywords (keywords passed to it
will be treated as a positional hash).

Fixes deprecation warning when using Sequel's postgres adapter in
Ruby 2.7.
@larskanis larskanis merged commit 2187b13 into ged:master May 28, 2022
@stanhu
Copy link

stanhu commented Jun 20, 2022

Actually, I'm seeing this warning in 1.4.0 now:

DEPRECATION WARNING: /Users/stanhu/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/pg-1.4.0/lib/pg.rb:69: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/stanhu/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/pg-1.4.0/lib/pg/connection.rb:660: warning: The called method `new' is defined here

This may be coming from Rails v6.1.4.7:

(byebug) bt
--> #0  #<Class:PG::Connection>.new(*args#Array, kwargs#Hash) at /Users/stanhu/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/pg-1.4.0/lib/pg/connection.rb:663
    #1  #<Class:PG>.connect(*args#Array, &block#NilClass) at /Users/stanhu/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/pg-1.4.0/lib/pg.rb:69
    #2  #<Class:ActiveRecord::ConnectionAdapters::PostgreSQLAdapter>.new_client(conn_params#Hash) at /Users/stanhu/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4.7/lib/active_record/connection_adapters/postgresql_adapter.rb:78

Which seems to be fixed via rails/rails@c3a0e32.

@jeremyevans
Copy link
Contributor Author

This pull request to fix the issue was correct. This issue was reintroduced in 6d61d3d. It seems broken unnecessarily, since the **kwargs are not even used by new, just passed to connect_to_hosts, which only accepts *args. I'll send another pull request to fix this new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants