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: 6f3d2869f6a4
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 26664476024b
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jan 20, 2018

  1. Check an encoding of string

    MRI checks an encoding of string is broken
    before conveting string to symbol.
    This commit will fix `#test_symbol_encoding`.
    
    Ref: https://github.com/ruby/ruby/blob/v2_5_0/symbol.c#L432
    yui-knk committed Jan 20, 2018
    Copy the full SHA
    939c70f View commit details
  2. Merge pull request #4992 from yui-knk/fix_test_symbol_encoding

    Check an encoding of string
    enebo authored Jan 20, 2018
    Copy the full SHA
    2666447 View commit details
Showing with 4 additions and 1 deletion.
  1. +4 −0 core/src/main/java/org/jruby/RubyString.java
  2. +0 −1 test/mri/excludes/TestSymbol.rb
4 changes: 4 additions & 0 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -5217,6 +5217,10 @@ private RubySymbol to_sym() {
RubySymbol specialCaseIntern = checkSpecialCasesIntern(value);
if (specialCaseIntern != null) return specialCaseIntern;

if (scanForCodeRange() == CR_BROKEN) {
throw getRuntime().newEncodingError("invalid symbol in encoding " + getEncoding() + " :" + inspect());
}

RubySymbol symbol = getRuntime().getSymbolTable().getSymbol(value);
if (symbol.getBytes() == value) shareLevel = SHARE_LEVEL_BYTELIST;
return symbol;
1 change: 0 additions & 1 deletion test/mri/excludes/TestSymbol.rb
Original file line number Diff line number Diff line change
@@ -3,5 +3,4 @@
exclude :test_to_proc_arg, "we have plans to do different caching here, see 69662ab8cd1616a2ee076488226a473648fc6267"
exclude :test_to_proc_binding, "needs investigation #4303"
exclude :test_to_proc_iseq, "needs investigation #4303"
exclude :test_symbol_encoding, "needs investigation"
exclude :test_symbol_fstr_leak, "assert_no_memory_leak fails due an unexpected nil"