Skip to content

Possible Keyword Argument Regression in 9.4.6.0 #8119

@jeremyevans

Description

@jeremyevans

First, I'd like to apologize that I do not have a simple reproducer for this issue. However, as this appears to be a regression from 9.4.5.0, and the 9.4.6.0 changelog lists keyword related work. I'm guessing it is related to those changes.

Environment Information

Passes on:
jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 17.0.9+9-1 on 17.0.9+9-1 +jit [x86_64-OpenBSD]

Fails on:
jruby 9.4.6.0 (3.1.4) 2024-02-20 576fab2c51 OpenJDK 64-Bit Server VM 17.0.9+9-1 on 17.0.9+9-1 +jit [x86_64-OpenBSD]

Operating System: OpenBSD/amd64

I tried but could not reproduce the issue on Windows. It passed for both:

jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913fda OpenJDK 64-Bit Server VM 20.0.1+9-29 on 20.0.1+9-29 +jit [x86_64-mswin32]
jruby 9.4.6.0 (3.1.4) 2024-02-20 576fab2c51 OpenJDK 64-Bit Server VM 20.0.1+9-29 on 20.0.1+9-29 +jit [x86_64-mswin32]

However, the failure is test-order dependent (the reason a specific seed is specified below), and it's possible the same seed that triggers the issue on OpenBSD does not trigger it on Windows. Or potentially it is JVM related, and affects JVM 17 but not JVM 20.

Reproducer (on 9.4.6.0):

git clone  --depth 100 https://github.com/jeremyevans/sequel.git
cd sequel
git checkout 17f0509c29561691fb908292b9d9e48ab3d19fcc
jruby -S gem install minitest-global_expectations minitest-hooks
SEED=43714 jruby -vw spec/model_spec.rb

Expected Behavior

Passes, as on JRuby 9.4.5.0:

jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 17.0.9+9-1 on 17.0.9+9-1 +jit [x86_64-OpenBSD]
Run options: --seed 43714

# Running:

..............................................................................................................................................................................................................................................................
..............................................................................................................................................................................................................................................................
..............................................................................................................................................................................................................................................................
..............................................................................................................................................................................................................................................................
..............................................................................................................................................................................................................................................................
........................................................................................................................................................................................................

Finished in 16.150142s, 91.0209 runs/s, 239.6264 assertions/s.

1470 runs, 3870 assertions, 0 failures, 0 errors, 0 skips

Actual Behavior

Fails on JRuby 9.4.6.0:

jruby 9.4.6.0 (3.1.4) 2024-02-20 576fab2c51 OpenJDK 64-Bit Server VM 17.0.9+9-1 on 17.0.9+9-1 +jit [x86_64-OpenBSD]
Run options: --seed 43714

# Running:

..............................................................................................................................................................................................................................................................
................................................................................................................E.........E.............................E.....................................................................................................
..............................................................................................................................................................................................................................................................
..............................................................................................................................................................................................................................................................
..............................................................................................................................................................................................................................................................
........................................................................................................................................................................................................

Finished in 16.422840s, 89.5095 runs/s, 235.4647 assertions/s.

  1) Error:
Sequel::Model::one_to_many#test_0068_should support a :remover option that accepts keywords:
ArgumentError: wrong number of arguments (given 2, expected 1)
    (eval):1:in `block in test_0068_should support a :remover option that accepts keywords'
    /sequel/lib/sequel/model/associations.rb:2785:in `remove_associated_object'
    /sequel/lib/sequel/model/associations.rb:2086:in `block in def_association_instance_methods'
    /sequel/spec/model/associations_spec.rb:2153:in `block in <main>'

  2) Error:
Sequel::Model::one_to_many#test_0064_should support an :adder option that accepts keywords:
ArgumentError: wrong number of arguments (given 2, expected 1)
    (eval):1:in `block in test_0064_should support an :adder option that accepts keywords'
    /sequel/lib/sequel/model/associations.rb:2614:in `add_associated_object'
    /sequel/lib/sequel/model/associations.rb:2081:in `block in def_association_instance_methods'
    /sequel/spec/model/associations_spec.rb:2108:in `block in <main>'

  3) Error:
Sequel::Model::one_to_many#test_0073_should support a :clearer option that supports keywords:
ArgumentError: wrong number of arguments (given 1, expected 0)
    (eval):1:in `block in test_0073_should support a :clearer option that supports keywords'
    /sequel/lib/sequel/model/associations.rb:2762:in `remove_all_associated_objects'
    /sequel/lib/sequel/model/associations.rb:2091:in `block in def_association_instance_methods'
    /sequel/spec/model/associations_spec.rb:2204:in `block in <main>'

1470 runs, 3867 assertions, 0 failures, 3 errors, 0 skips

The three failing specs all run through code that uses ruby2_keywords on a method defined by define_method, and it appears the ruby2_keywords call is not respected, as it attempts to pass the keywords as positional arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions