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: 51315e01561e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 40e1ead25282
Choose a head ref
  • 6 commits
  • 11 files changed
  • 1 contributor

Commits on Feb 7, 2016

  1. Copy the full SHA
    db82b21 View commit details
  2. Copy the full SHA
    9cfffaf View commit details
  3. Copy the full SHA
    2b4a9f7 View commit details
  4. Update to json 1.8.3.

    headius committed Feb 7, 2016
    Copy the full SHA
    16a141f View commit details
  5. Exclude and fix some tests for 2.3.

    * The NameError#local_variables test was pulled out since it seems
      to be an internal function for MRI.
    headius committed Feb 7, 2016
    Copy the full SHA
    ef53b1f View commit details
  6. Copy the full SHA
    40e1ead View commit details
27 changes: 15 additions & 12 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -5413,13 +5413,19 @@ public IRubyObject strScrub(ThreadContext context, IRubyObject repl, Block block
int cr = getCodeRange();
Encoding enc;
Encoding encidx;
IRubyObject buf = context.nil;
byte[] repBytes;
int rep;
int replen;
boolean tainted = false;

if (cr == CR_7BIT || cr == CR_VALID)
return context.nil;

enc = EncodingUtils.STR_ENC_GET(this);
if (!repl.isNil()) {
repl = EncodingUtils.strCompatAndValid(context, repl, enc);
tainted |= repl.isTaint();
}

if (enc.isDummy()) {
@@ -5432,11 +5438,7 @@ public IRubyObject strScrub(ThreadContext context, IRubyObject repl, Block block
int p = value.begin();
int e = p + value.getRealSize();
int p1 = p;
byte[] repBytes;
int rep;
int replen;
boolean rep7bit_p;
IRubyObject buf = context.nil;
if (block.isGiven()) {
repBytes = null;
rep = 0;
@@ -5507,6 +5509,7 @@ else if (MBCLEN_INVALID_P(ret)) {
else {
repl = block.yieldSpecific(context, RubyString.newString(runtime, pBytes, p, clen, enc));
repl = EncodingUtils.strCompatAndValid(context, repl, enc);
tainted |= repl.isTaint();
((RubyString)buf).cat((RubyString)repl);
if (((RubyString)repl).getCodeRange() == CR_VALID)
cr = CR_VALID;
@@ -5538,24 +5541,19 @@ else if (MBCLEN_INVALID_P(ret)) {
else {
repl = block.yieldSpecific(context, RubyString.newString(runtime, pBytes, p, e - p, enc));
repl = EncodingUtils.strCompatAndValid(context, repl, enc);
tainted |= repl.isTaint();
((RubyString)buf).cat((RubyString)repl);
if (((RubyString)repl).getCodeRange() == CR_VALID)
cr = CR_VALID;
}
}
((RubyString)buf).setEncodingAndCodeRange(enc, cr);
return buf;
}
else {
/* ASCII incompatible */
byte[] pBytes = value.unsafeBytes();
int p = value.begin();
int e = p + value.getRealSize();
int p1 = p;
IRubyObject buf = context.nil;
byte[] repBytes;
int rep;
int replen;
int mbminlen = enc.minLength();
if (!repl.isNil()) {
repBytes = ((RubyString)repl).value.unsafeBytes();
@@ -5620,6 +5618,7 @@ else if (MBCLEN_INVALID_P(ret)) {
else {
repl = block.yieldSpecific(context, RubyString.newString(runtime, pBytes, p, e-p, enc));
repl = EncodingUtils.strCompatAndValid(context, repl, enc);
tainted |= repl.isTaint();
((RubyString)buf).cat((RubyString)repl);
}
p += clen;
@@ -5643,12 +5642,16 @@ else if (MBCLEN_INVALID_P(ret)) {
else {
repl = block.yieldSpecific(context, RubyString.newString(runtime, pBytes, p, e - p, enc));
repl = EncodingUtils.strCompatAndValid(context, repl, enc);
tainted |= repl.isTaint();
((RubyString)buf).cat((RubyString)repl);
}
}
((RubyString)buf).setEncodingAndCodeRange(enc, CR_VALID);
return buf;
cr = CR_VALID;
}

buf.setTaint(tainted | isTaint());
((RubyString)buf).setEncodingAndCodeRange(enc, cr);
return buf;
}

// MRI: rb_str_offset
13 changes: 13 additions & 0 deletions core/src/main/java/org/jruby/RubyThread.java
Original file line number Diff line number Diff line change
@@ -906,6 +906,8 @@ public synchronized IRubyObject op_aref(IRubyObject key) {

@JRubyMethod(name = "[]=", required = 2)
public synchronized IRubyObject op_aset(IRubyObject key, IRubyObject value) {
checkFrozen();

key = getSymbolKey(key);

getFiberLocals().put(key, value);
@@ -1513,6 +1515,9 @@ public IRubyObject backtrace20(ThreadContext context, IRubyObject[] args) {
// nativeThread can be null if the thread has terminated and GC has claimed it
if (nativeThread == null) return context.nil;

// nativeThread may have finished
if (!nativeThread.isAlive()) return context.nil;

Ruby runtime = context.runtime;
Integer[] ll = RubyKernel.levelAndLengthFromArgs(runtime, args, 0);
Integer level = ll[0], length = ll[1];
@@ -1526,6 +1531,14 @@ public IRubyObject backtrace_locations(ThreadContext context, IRubyObject[] args

if (myContext == null) return context.nil;

Thread nativeThread = getNativeThread();

// nativeThread can be null if the thread has terminated and GC has claimed it
if (nativeThread == null) return context.nil;

// nativeThread may have finished
if (!nativeThread.isAlive()) return context.nil;

Ruby runtime = context.runtime;
Integer[] ll = RubyKernel.levelAndLengthFromArgs(runtime, args, 0);
Integer level = ll[0], length = ll[1];
2 changes: 1 addition & 1 deletion pom.rb
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@
'polyglot.dump.readonly' => 'true',
'jruby.plugins.version' => '1.0.10',

'json.version' => '1.8.1',
'json.version' => '1.8.3',
'rspec.version' => '3.3.0',
'rspec-core.version' => '3.3.2',
'rspec-expectations.version' => '3.3.1',
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ DO NOT MODIFIY - GENERATED CODE
<rspec-mocks.version>3.3.2</rspec-mocks.version>
<jruby.plugins.version>1.0.10</jruby.plugins.version>
<invoker.skip>true</invoker.skip>
<json.version>1.8.1</json.version>
<json.version>1.8.3</json.version>
<jar-dependencies.version>0.2.3</jar-dependencies.version>
<power_assert.version>0.2.3</power_assert.version>
<version.jruby>${project.version}</version.jruby>
3 changes: 3 additions & 0 deletions test/mri/excludes/TestException.rb
Original file line number Diff line number Diff line change
@@ -7,3 +7,6 @@

exclude /test_machine_stackoverflow/, reason
exclude :test_machine_stackoverflow_by_define_method, reason
exclude :test_name_error_local_variables, "NameError#local_variables is internal and specific to MRI"
exclude :test_stackoverflow, reason
exclude :test_too_many_args_in_eval, "MRI raises SystemStackError for huge number of args, for some reason"
2 changes: 2 additions & 0 deletions test/mri/excludes/TestGc.rb
Original file line number Diff line number Diff line change
@@ -2,8 +2,10 @@
exclude :test_exception_in_finalizer, "broken subprocess logic"
exclude :test_expand_heap, "broken subprocess logic"
exclude :test_finalizing_main_thread, "broken subprocess logic"
exclude :test_gc_disabled_start, "expects GC.start to force GC run"
exclude :test_gc_parameter, "MRI-specific"
exclude :test_gc_internals, "MRI-specific"
exclude :test_interrupt_in_finalizer, "JRuby handles signals on a separate thread, plus a lot of hinky logic in this test"
exclude :test_latest_gc_info, ""
exclude :test_latest_gc_info_argument, ""
exclude :test_profiler_clear, "broken subprocess logic"
17 changes: 16 additions & 1 deletion test/mri/excludes/TestIO_Console.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
# frozen_string_literal: false
exclude(:test_getpass, 'not portable')
exclude :test_cooked, 'depends on unimplemented PTY functionality'
exclude :test_echo, 'depends on unimplemented PTY functionality'
exclude :test_getpass, 'not portable'
exclude :test_iflush, 'depends on unimplemented PTY functionality'
exclude :test_ioflush, 'depends on unimplemented PTY functionality'
exclude :test_ioflush2, 'depends on unimplemented PTY functionality'
exclude :test_noecho, 'depends on unimplemented PTY functionality'
exclude :test_noecho2, 'depends on unimplemented PTY functionality'
exclude :test_oflush, 'depends on unimplemented PTY functionality'
exclude :test_raw, 'depends on unimplemented PTY functionality'
exclude :test_raw!, 'depends on unimplemented PTY functionality'
exclude :test_raw_minchar, 'depends on unimplemented PTY functionality'
exclude :test_raw_timeout, 'depends on unimplemented PTY functionality'
exclude :test_setecho, 'depends on unimplemented PTY functionality'
exclude :test_setecho2, 'depends on unimplemented PTY functionality'
exclude :test_winsize, 'depends on unimplemented PTY functionality'
22 changes: 12 additions & 10 deletions test/mri/excludes/TestObjectSpace.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
exclude :test_count_objects, "needs investigation"
exclude :test_each_object, "needs investigation"
exclude :test_finalizer, "needs investigation"
exclude :test_id2ref_18, "needs investigation"
exclude :test_id2ref_28, "needs investigation"
exclude :test_id2ref_29, "needs investigation"
exclude :test_id2ref_30, "needs investigation"
exclude :test_id2ref_31, "needs investigation"
exclude :test_id2ref_32, "needs investigation"
exclude :test_id2ref_33, "needs investigation"
exclude :test_count_objects, "we don't run this suite with ObjectSpace on"
exclude :test_each_object, "we don't run this suite with ObjectSpace on"
exclude :test_each_object_enumerator, "we don't run this suite with ObjectSpace on"
exclude :test_each_object_no_gabage, "we don't run this suite with ObjectSpace on"
exclude :test_finalizer, "we don't run this suite with ObjectSpace on"
exclude :test_id2ref_18, "we don't run this suite with ObjectSpace on"
exclude :test_id2ref_28, "we don't run this suite with ObjectSpace on"
exclude :test_id2ref_29, "we don't run this suite with ObjectSpace on"
exclude :test_id2ref_30, "we don't run this suite with ObjectSpace on"
exclude :test_id2ref_31, "we don't run this suite with ObjectSpace on"
exclude :test_id2ref_32, "we don't run this suite with ObjectSpace on"
exclude :test_id2ref_33, "we don't run this suite with ObjectSpace on"
1 change: 1 addition & 0 deletions test/mri/excludes/TestThread.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: false
exclude(/_stack_size$/, 'often too expensive')
exclude :test_mutex_interrupt, "hangs"
exclude :test_safe_level, "SAFE levels are unsupported"
exclude :test_thread_join_main_thread, "hangs"
11 changes: 11 additions & 0 deletions test/mri/ruby/test_exception.rb
Original file line number Diff line number Diff line change
@@ -698,6 +698,17 @@ def obj.test(a, b=nil, *c, &d)
}
assert_equal(:foo, e.name)
assert_same(obj, e.receiver)
end

def test_name_error_local_variables
obj = BasicObject.new
def obj.test(a, b=nil, *c, &d)
e = a
1.times {|f| g = foo}
end
e = assert_raise(NameError) {
obj.test(3)
}
assert_equal(%i[a b c d e f g], e.local_variables.sort)
end

2 changes: 1 addition & 1 deletion test/mri/ruby/test_module.rb
Original file line number Diff line number Diff line change
@@ -451,7 +451,7 @@ def test_included_modules
end

def test_instance_methods
assert_equal([:user, :user2], User.instance_methods(false))
assert_equal([:user, :user2], User.instance_methods(false).sort)
assert_equal([:user, :user2, :mixin].sort, User.instance_methods(true).sort)
assert_equal([:mixin], Mixin.instance_methods)
assert_equal([:mixin], Mixin.instance_methods(true))