From 213349485ac6296e3b423dec50c8dd2a748adac1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Jul 2017 21:31:51 -0400 Subject: add libre/ruby2.3 --- libre/ruby2.3/json-1.8.3-libre.patch | 121 +++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 libre/ruby2.3/json-1.8.3-libre.patch (limited to 'libre/ruby2.3/json-1.8.3-libre.patch') diff --git a/libre/ruby2.3/json-1.8.3-libre.patch b/libre/ruby2.3/json-1.8.3-libre.patch new file mode 100644 index 000000000..93ae03ee0 --- /dev/null +++ b/libre/ruby2.3/json-1.8.3-libre.patch @@ -0,0 +1,121 @@ +diff --git a/lib/json.rb b/lib/json.rb +index 61bb8fae0e..8132cd571c 100644 +--- a/lib/json.rb ++++ b/lib/json.rb +@@ -55,9 +55,5 @@ require 'json/common' + module JSON + require 'json/version' + +- begin +- require 'json/ext' +- rescue LoadError +- require 'json/pure' +- end ++ require 'json/pure' + end +diff --git a/tests/setup_variant.rb b/tests/setup_variant.rb +index f7fb2a1d56..5e9e050a26 100644 +--- a/tests/setup_variant.rb ++++ b/tests/setup_variant.rb +@@ -1,12 +1,3 @@ + # frozen_string_literal: false +-case ENV['JSON'] +-when 'pure' +- $:.unshift 'lib' +- require 'json/pure' +-when 'ext' +- $:.unshift 'ext', 'lib' +- require 'json/ext' +-else +- $:.unshift 'ext', 'lib' +- require 'json' +-end ++$:.unshift 'lib' ++require 'json' +diff --git a/tests/test_json.rb b/tests/test_json.rb +index 8fe9459978..b81ee506af 100755 +--- a/tests/test_json.rb ++++ b/tests/test_json.rb +@@ -537,15 +537,6 @@ EOT + assert_equal orig, JSON[json5][0] + end + +- if defined?(JSON::Ext::Parser) +- def test_allocate +- parser = JSON::Ext::Parser.new("{}") +- assert_raise(TypeError, '[ruby-core:35079]') {parser.__send__(:initialize, "{}")} +- parser = JSON::Ext::Parser.allocate +- assert_raise(TypeError, '[ruby-core:35079]') {parser.source} +- end +- end +- + def test_argument_encoding + source = "{}".force_encoding("ascii-8bit") + JSON::Parser.new(source) +@@ -565,13 +556,13 @@ EOT + if EnvUtil.gc_stress_to_class? + def assert_no_memory_leak(code, *rest, **opt) + code = "8.times {20_000.times {begin #{code}; rescue NoMemoryError; end}; GC.start}" +- super(["-rjson/ext/parser"], +- "GC.add_stress_to_class(JSON::Ext::Parser); "\ ++ super(["-rjson/pure/parser"], ++ "GC.add_stress_to_class(JSON::Pure::Parser); "\ + "#{code}", code, *rest, rss: true, limit: 1.1, **opt) + end + + def test_no_memory_leak_allocate +- assert_no_memory_leak("JSON::Ext::Parser.allocate") ++ assert_no_memory_leak("JSON::Pure::Parser.allocate") + end + end + end +diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb +index 50895f6247..f85dd3a81c 100755 +--- a/tests/test_json_generate.rb ++++ b/tests/test_json_generate.rb +@@ -283,28 +283,6 @@ EOT + assert_equal '2', state.indent + end + +- if defined?(JSON::Ext::Generator) +- def test_broken_bignum # [ruby-core:38867] +- pid = fork do +- Bignum.class_eval do +- def to_s +- end +- end +- begin +- JSON::Ext::Generator::State.new.generate(1<<64) +- exit 1 +- rescue TypeError +- exit 0 +- end +- end +- _, status = Process.waitpid2(pid) +- assert status.success? +- rescue NotImplementedError +- # forking to avoid modifying core class of a parent process and +- # introducing race conditions of tests are run in parallel +- end +- end +- + def test_hash_likeness_set_symbol + state = JSON.state.new + assert_equal nil, state[:foo] +@@ -349,13 +327,13 @@ EOT + if EnvUtil.gc_stress_to_class? + def assert_no_memory_leak(code, *rest, **opt) + code = "8.times {20_000.times {begin #{code}; rescue NoMemoryError; end}; GC.start}" +- super(["-rjson/ext/generator"], +- "GC.add_stress_to_class(JSON::Ext::Generator::State); "\ ++ super(["-rjson/pure/generator"], ++ "GC.add_stress_to_class(JSON::Pure::Generator::State); "\ + "#{code}", code, *rest, rss: true, limit: 1.1, **opt) + end + + def test_no_memory_leak_allocate +- assert_no_memory_leak("JSON::Ext::Generator::State.allocate") ++ assert_no_memory_leak("JSON::Pure::Generator::State.allocate") + end + end + end -- cgit v1.2.3