oj 3.11.0 → 3.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a9281dd44fc3a292de885df89aea20d98fc76c658a6bdc5291af8a1823c521c
4
- data.tar.gz: 2aaeeee785c97a6d11f5188fe285e2dc0cd89df24408b08f9de537e3c5f602e2
3
+ metadata.gz: 698d68ef4c5a05318046700568e3d19c9d5e40644950c76cf02d31490a4bd738
4
+ data.tar.gz: 1cff670f6587f0080108980d339f9c8cff3097bb5e7cf67a2c583e8745385b7b
5
5
  SHA512:
6
- metadata.gz: '0787f0efdc46414a5b228aab320eb4c41242100da6f6e2598fcb6afaa08e9eeaaf0c524dce001899aac0e4015c252ef1d4dc399a6eea68bef32f18e9268f018a'
7
- data.tar.gz: 3298dbc834012e9981bda042e827b572ef17a0a1a827a8f07e4bc921df5ec940cdaa5f41f7c8f41a9571fc4fcda86c1fd81c96b214754bad33a3e15d66786cee
6
+ metadata.gz: 3cfb98a97ead48a89f95af28dc364633199afb5cbe269ba07b90a26eabe77d9e59c1051731e07ff3821233bdf10d54896c2e9821786dfee2140beaac9dc8c0d2
7
+ data.tar.gz: 79173558b0cc6e4cb9852c32e7949d88396ffbb8f34cc7781f6144ade5c7ecf5cf8b24a374056ee50e8367d96ba79510cf8ba21a19acd8e52a61c8c731b44921
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # [![{}j](http://www.ohler.com/dev/images/oj_comet_64.svg)](http://www.ohler.com/oj) gem
2
2
 
3
- [![Build Status](https://img.shields.io/travis/ohler55/oj/master.svg?logo=travis)](http://travis-ci.org/ohler55/oj?branch=master) [![AppVeyor](https://img.shields.io/appveyor/ci/ohler55/oj/master.svg?logo=appveyor)](https://ci.appveyor.com/project/ohler55/oj) ![Gem](https://img.shields.io/gem/v/oj.svg) ![Gem](https://img.shields.io/gem/dt/oj.svg) [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=oj&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=oj&package-manager=bundler&version-scheme=semver) [![TideLift](https://tidelift.com/badges/github/ohler55/oj)](https://tidelift.com/subscription/pkg/rubygems-oj?utm_source=rubygems-oj&utm_medium=referral&utm_campaign=readme)
3
+ [![Build Status](https://img.shields.io/travis/ohler55/oj/master.svg?logo=travis)](http://travis-ci.org/ohler55/oj?branch=master) ![Gem](https://img.shields.io/gem/v/oj.svg) ![Gem](https://img.shields.io/gem/dt/oj.svg) [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=oj&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=oj&package-manager=bundler&version-scheme=semver) [![TideLift](https://tidelift.com/badges/github/ohler55/oj)](https://tidelift.com/subscription/pkg/rubygems-oj?utm_source=rubygems-oj&utm_medium=referral&utm_campaign=readme)
4
4
 
5
5
  A *fast* JSON parser and Object marshaller as a Ruby gem.
6
6
 
@@ -841,6 +841,7 @@ oj_mimic_json_methods(VALUE json) {
841
841
  }
842
842
  // Pull in the JSON::State mimic file.
843
843
  state_class = rb_const_get_at(generator, rb_intern("State"));
844
+ rb_gc_register_mark_object(state_class);
844
845
 
845
846
  symbolize_names_sym = ID2SYM(rb_intern("symbolize_names")); rb_gc_register_address(&symbolize_names_sym);
846
847
  }
@@ -1649,13 +1649,21 @@ Init_oj() {
1649
1649
  rb_require("oj/schandler");
1650
1650
 
1651
1651
  oj_bag_class = rb_const_get_at(Oj, rb_intern("Bag"));
1652
+ rb_gc_register_mark_object(oj_bag_class);
1652
1653
  oj_bigdecimal_class = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
1654
+ rb_gc_register_mark_object(oj_bigdecimal_class);
1653
1655
  oj_date_class = rb_const_get(rb_cObject, rb_intern("Date"));
1656
+ rb_gc_register_mark_object(oj_date_class);
1654
1657
  oj_datetime_class = rb_const_get(rb_cObject, rb_intern("DateTime"));
1658
+ rb_gc_register_mark_object(oj_datetime_class);
1655
1659
  oj_enumerable_class = rb_const_get(rb_cObject, rb_intern("Enumerable"));
1660
+ rb_gc_register_mark_object(oj_enumerable_class);
1656
1661
  oj_parse_error_class = rb_const_get_at(Oj, rb_intern("ParseError"));
1662
+ rb_gc_register_mark_object(oj_parse_error_class);
1657
1663
  oj_stringio_class = rb_const_get(rb_cObject, rb_intern("StringIO"));
1664
+ rb_gc_register_mark_object(oj_stringio_class);
1658
1665
  oj_struct_class = rb_const_get(rb_cObject, rb_intern("Struct"));
1666
+ rb_gc_register_mark_object(oj_struct_class);
1659
1667
  oj_json_parser_error_class = rb_eEncodingError; // replaced if mimic is called
1660
1668
  oj_json_generator_error_class = rb_eEncodingError; // replaced if mimic is called
1661
1669
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.11.0'
4
+ VERSION = '3.11.1'
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+ #
1
3
  # Ubuntu does not accept arguments to ruby when called using env. To get warnings to show up the -w options is
2
4
  # required. That can be set in the RUBYOPT environment variable.
3
5
  # export RUBYOPT=-w
@@ -16,6 +18,14 @@ require 'bigdecimal'
16
18
  require 'pp'
17
19
  require 'oj'
18
20
 
21
+
22
+ if defined?(GC.verify_compaction_references) == 'method'
23
+ # This method was added in Ruby 3.0.0. Calling it this way asks the GC to
24
+ # move objects around, helping to find object movement bugs.
25
+ GC.verify_compaction_references(double_heap: true, toward: :empty)
26
+ end
27
+
28
+
19
29
  $ruby = RUBY_DESCRIPTION.split(' ')[0]
20
30
  $ruby = 'ree' if 'ruby' == $ruby && RUBY_DESCRIPTION.include?('Ruby Enterprise Edition')
21
31
 
@@ -136,6 +136,10 @@ EOT
136
136
 
137
137
  def test_pretty_state
138
138
  state = JSON::PRETTY_STATE_PROTOTYPE.dup
139
+ # In come cases in Ruby 3.0 an :escape_slash is included in the state. It
140
+ # seems to occur on travis but not locally.
141
+ actual = state.to_h
142
+ actual.delete(:escape_slash)
139
143
  assert_equal({
140
144
  :allow_nan => false,
141
145
  :array_nl => "\n",
@@ -147,11 +151,15 @@ EOT
147
151
  :object_nl => "\n",
148
152
  :space => " ",
149
153
  :space_before => "",
150
- }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s })
154
+ }.sort_by { |n,| n.to_s }, actual.sort_by { |n,| n.to_s })
151
155
  end
152
156
 
153
157
  def test_safe_state
154
158
  state = JSON::SAFE_STATE_PROTOTYPE.dup
159
+ # In come cases in Ruby 3.0 an :escape_slash is included in the state. It
160
+ # seems to occur on travis but not locally.
161
+ actual = state.to_h
162
+ actual.delete(:escape_slash)
155
163
  assert_equal({
156
164
  :allow_nan => false,
157
165
  :array_nl => "",
@@ -163,11 +171,15 @@ EOT
163
171
  :object_nl => "",
164
172
  :space => "",
165
173
  :space_before => "",
166
- }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s })
174
+ }.sort_by { |n,| n.to_s }, actual.sort_by { |n,| n.to_s })
167
175
  end
168
176
 
169
177
  def test_fast_state
170
178
  state = JSON::FAST_STATE_PROTOTYPE.dup
179
+ # In come cases in Ruby 3.0 an :escape_slash is included in the state. It
180
+ # seems to occur on travis but not locally.
181
+ actual = state.to_h
182
+ actual.delete(:escape_slash)
171
183
  assert_equal({
172
184
  :allow_nan => false,
173
185
  :array_nl => "",
@@ -179,7 +191,7 @@ EOT
179
191
  :object_nl => "",
180
192
  :space => "",
181
193
  :space_before => "",
182
- }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s })
194
+ }.sort_by { |n,| n.to_s }, actual.sort_by { |n,| n.to_s })
183
195
  end
184
196
 
185
197
  def test_allow_nan
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $: << File.dirname(__FILE__)
2
4
  $oj_dir = File.dirname(File.dirname(File.expand_path(File.dirname(__FILE__))))
3
5
  %w(lib ext).each do |dir|
@@ -12,6 +14,12 @@ if ENV['REAL_JSON_GEM']
12
14
  else
13
15
  require 'oj'
14
16
  Oj.mimic_JSON
17
+
18
+ if defined?(GC.verify_compaction_references) == 'method'
19
+ # This method was added in Ruby 3.0.0. Calling it this way asks the GC to
20
+ # move objects around, helping to find object movement bugs.
21
+ GC.verify_compaction_references(double_heap: true, toward: :empty)
22
+ end
15
23
  end
16
24
 
17
25
  NaN = JSON::NaN if defined?(JSON::NaN)
@@ -178,7 +178,7 @@ class CompatJuice < Minitest::Test
178
178
  assert_equal('"abc"', json)
179
179
  end
180
180
 
181
- def test_time
181
+ def test_time_xml_schema
182
182
  t = Time.xmlschema("2012-01-05T23:58:07.123456000+09:00")
183
183
  #t = Time.local(2012, 1, 5, 23, 58, 7, 123456)
184
184
  json = Oj.dump(t, :mode => :compat)
@@ -297,7 +297,7 @@ class CompatJuice < Minitest::Test
297
297
  end
298
298
 
299
299
  # Time
300
- def test_time
300
+ def test_time_from_time_object
301
301
  t = Time.new(2015, 1, 5, 21, 37, 7.123456, -8 * 3600)
302
302
  expect = '"' + t.to_s + '"'
303
303
  json = Oj.dump(t)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-12 00:00:00.000000000 Z
11
+ date: 2021-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler