Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f8de9a00c2ce
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 68c886e9fe73
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jan 29, 2018

  1. Do modifyCheck for each pair in Array#sort!

    as calling comparison could freeze the Array and should trigger a RuntimeError.
    ChrisBr committed Jan 29, 2018
    Copy the full SHA
    2776815 View commit details

Commits on Feb 1, 2018

  1. Merge pull request #5021 from ChrisBr/bug/frozen_sort

    Do modifyCheck for each pair in Array#sort!
    enebo authored Feb 1, 2018
    Copy the full SHA
    68c886e View commit details
Showing with 6 additions and 5 deletions.
  1. +6 −4 core/src/main/java/org/jruby/RubyArray.java
  2. +0 −1 test/mri/excludes/TestArray.rb
10 changes: 6 additions & 4 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -3492,8 +3492,9 @@ protected IRubyObject sortInternal(final ThreadContext context, final boolean ho
try {
Arrays.sort(values, begin, begin + realLength, new DefaultComparator(context, honorOverride) {
protected int compareGeneric(IRubyObject o1, IRubyObject o2) {
//TODO: ary_sort_check should be done here
return super.compareGeneric(o1, o2);
int result = super.compareGeneric(o1, o2);
modifyCheck();
return result;
}
});
}
@@ -3630,8 +3631,9 @@ protected IRubyObject sortInternal(final ThreadContext context, final Block bloc
Arrays.sort(newValues, 0, length, new BlockComparator(context, block, gt, lt) {
@Override
public int compare(IRubyObject obj1, IRubyObject obj2) {
//TODO: ary_sort_check should be done here
return super.compare(obj1, obj2);
int result = super.compare(obj1, obj2);
modifyCheck();
return result;
}
});

1 change: 0 additions & 1 deletion test/mri/excludes/TestArray.rb
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
exclude :test_rindex2, "needs investigation"
exclude :test_sample_random, "gen2 conc modifies ary"
exclude :test_shuffle_random, "gen conc modifies ary"
exclude :test_sort_bang_with_freeze, ""
exclude :test_sort_with_callcc, "no callcc"
exclude :test_to_h, ""
exclude :test_values_at2, ""