json 2.4.1 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +24 -5
- data/README.md +3 -3
- data/VERSION +1 -1
- data/ext/json/ext/generator/generator.c +13 -17
- data/ext/json/ext/parser/extconf.rb +1 -0
- data/ext/json/ext/parser/parser.c +2971 -1797
- data/ext/json/ext/parser/parser.h +5 -1
- data/ext/json/ext/parser/parser.rl +106 -53
- data/json.gemspec +3 -9
- data/lib/json/common.rb +34 -13
- data/lib/json/pure/parser.rb +1 -1
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +1 -1
- metadata +6 -82
- data/Gemfile +0 -14
- data/lib/json/ext/.keep +0 -0
- data/tests/fixtures/fail10.json +0 -1
- data/tests/fixtures/fail11.json +0 -1
- data/tests/fixtures/fail12.json +0 -1
- data/tests/fixtures/fail13.json +0 -1
- data/tests/fixtures/fail14.json +0 -1
- data/tests/fixtures/fail18.json +0 -1
- data/tests/fixtures/fail19.json +0 -1
- data/tests/fixtures/fail2.json +0 -1
- data/tests/fixtures/fail20.json +0 -1
- data/tests/fixtures/fail21.json +0 -1
- data/tests/fixtures/fail22.json +0 -1
- data/tests/fixtures/fail23.json +0 -1
- data/tests/fixtures/fail24.json +0 -1
- data/tests/fixtures/fail25.json +0 -1
- data/tests/fixtures/fail27.json +0 -2
- data/tests/fixtures/fail28.json +0 -2
- data/tests/fixtures/fail29.json +0 -1
- data/tests/fixtures/fail3.json +0 -1
- data/tests/fixtures/fail30.json +0 -1
- data/tests/fixtures/fail31.json +0 -1
- data/tests/fixtures/fail32.json +0 -1
- data/tests/fixtures/fail4.json +0 -1
- data/tests/fixtures/fail5.json +0 -1
- data/tests/fixtures/fail6.json +0 -1
- data/tests/fixtures/fail7.json +0 -1
- data/tests/fixtures/fail8.json +0 -1
- data/tests/fixtures/fail9.json +0 -1
- data/tests/fixtures/obsolete_fail1.json +0 -1
- data/tests/fixtures/pass1.json +0 -56
- data/tests/fixtures/pass15.json +0 -1
- data/tests/fixtures/pass16.json +0 -1
- data/tests/fixtures/pass17.json +0 -1
- data/tests/fixtures/pass2.json +0 -1
- data/tests/fixtures/pass26.json +0 -1
- data/tests/fixtures/pass3.json +0 -6
- data/tests/json_addition_test.rb +0 -199
- data/tests/json_common_interface_test.rb +0 -169
- data/tests/json_encoding_test.rb +0 -107
- data/tests/json_ext_parser_test.rb +0 -15
- data/tests/json_fixtures_test.rb +0 -40
- data/tests/json_generator_test.rb +0 -432
- data/tests/json_generic_object_test.rb +0 -82
- data/tests/json_parser_test.rb +0 -497
- data/tests/json_string_matching_test.rb +0 -38
- data/tests/test_helper.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28754306f4a5a73cb18a8a02a519b8efcfb84ff59c2cece37ba9c37dd157c29c
|
4
|
+
data.tar.gz: 3bdeda4996bde6e7f28e55cfd47dd278d5f65ed709ac5ec444da46a0fa878621
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b760312c30f7a69b57abc61f19ca2ca06a7d592d2dd5f51fe8d06c42763a74f91ef5474c339c4c8f8e6a1e29de1886e5e3e63ecc474ed205a9a1a49c4c1014c
|
7
|
+
data.tar.gz: 54a87c4287805b5af55c34578623d79b33f7a1c04ed739e3265423153a1e95952bc888adc5c0613c6e6ba48df96aa995eff9e74cc715491200db61707d3aa356
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
### 2021-10-24 (2.6.1)
|
4
|
+
|
5
|
+
* Restore version.rb with 2.6.1
|
6
|
+
|
7
|
+
### 2021-10-14 (2.6.0)
|
8
|
+
|
9
|
+
* Use `rb_enc_interned_str` if available to reduce allocations in `freeze: true` mode. #451.
|
10
|
+
* Bump required_ruby_version to 2.3.
|
11
|
+
* Fix compatibility with `GC.compact`.
|
12
|
+
* Fix some compilation warnings. #469
|
13
|
+
|
14
|
+
## 2020-12-22 (2.5.1)
|
15
|
+
|
16
|
+
* Restore the compatibility for constants of JSON class.
|
17
|
+
|
18
|
+
## 2020-12-22 (2.5.0)
|
19
|
+
|
20
|
+
* Ready to Ractor-safe at Ruby 3.0.
|
21
|
+
|
3
22
|
## 2020-12-17 (2.4.1)
|
4
23
|
|
5
24
|
* Restore version.rb with 2.4.1
|
@@ -75,7 +94,7 @@
|
|
75
94
|
|
76
95
|
## 2015-09-11 (2.0.0)
|
77
96
|
* Now complies to newest JSON RFC 7159.
|
78
|
-
* Implements
|
97
|
+
* Implements compatibility to ruby 2.4 integer unification.
|
79
98
|
* Drops support for old rubies whose life has ended, that is rubies < 2.0.
|
80
99
|
Also see https://www.ruby-lang.org/en/news/2014/07/01/eol-for-1-8-7-and-1-9-2/
|
81
100
|
* There were still some mentions of dual GPL licensing in the source, but JSON
|
@@ -116,9 +135,9 @@
|
|
116
135
|
## 2013-02-04 (1.7.7)
|
117
136
|
* Security fix for JSON create_additions default value and
|
118
137
|
`JSON::GenericObject`. It should not be possible to create additions unless
|
119
|
-
|
138
|
+
explicitly requested by setting the create_additions argument to true or
|
120
139
|
using the JSON.load/dump interface. If `JSON::GenericObject` is supposed to
|
121
|
-
be automatically deserialised, this has to be
|
140
|
+
be automatically deserialised, this has to be explicitly enabled by
|
122
141
|
setting
|
123
142
|
JSON::GenericObject.json_creatable = true
|
124
143
|
as well.
|
@@ -264,7 +283,7 @@
|
|
264
283
|
## 2010-04-23 (1.4.0)
|
265
284
|
* Major speed improvements and building with simplified
|
266
285
|
directory/file-structure.
|
267
|
-
* Extension should at least be
|
286
|
+
* Extension should at least be compatible with MRI, YARV and Rubinius.
|
268
287
|
|
269
288
|
## 2010-04-07 (1.2.4)
|
270
289
|
* Triger const_missing callback to make Rails' dynamic class loading work.
|
@@ -282,7 +301,7 @@
|
|
282
301
|
strings in object names/keys.
|
283
302
|
|
284
303
|
## 2009-10-01 (1.2.0)
|
285
|
-
* `fast_generate` now raises an
|
304
|
+
* `fast_generate` now raises an exception for nan and infinite floats.
|
286
305
|
* On Ruby 1.8 json supports parsing of UTF-8, UTF-16BE, UTF-16LE, UTF-32BE,
|
287
306
|
and UTF-32LE JSON documents now. Under Ruby 1.9 the M17n conversion
|
288
307
|
functions are used to convert from all supported encodings. ASCII-8BIT
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# JSON implementation for Ruby
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![CI](https://github.com/flori/json/actions/workflows/ci.yml/badge.svg)](https://github.com/flori/json/actions/workflows/ci.yml)
|
4
4
|
|
5
5
|
## Description
|
6
6
|
|
@@ -267,7 +267,7 @@ the `pp` library's `pp` methods.
|
|
267
267
|
|
268
268
|
The script `tools/server.rb` contains a small example if you want to test, how
|
269
269
|
receiving a JSON object from a webrick server in your browser with the
|
270
|
-
|
270
|
+
JavaScript prototype library http://www.prototypejs.org works.
|
271
271
|
|
272
272
|
## Speed Comparisons
|
273
273
|
|
@@ -294,7 +294,7 @@ extension:
|
|
294
294
|
```
|
295
295
|
|
296
296
|
In the table above 1 is `JSON::Ext::Parser`, 2 is `YAML.load` with YAML
|
297
|
-
|
297
|
+
compatible JSON document, 3 is is `JSON::Pure::Parser`, and 4 is
|
298
298
|
`ActiveSupport::JSON.decode`. The ActiveSupport JSON-decoder converts the
|
299
299
|
input first to YAML and then uses the YAML-parser, the conversion seems to
|
300
300
|
slow it down so much that it is only as fast as the `JSON::Pure::Parser`!
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.1
|
@@ -1,11 +1,6 @@
|
|
1
1
|
#include "../fbuffer/fbuffer.h"
|
2
2
|
#include "generator.h"
|
3
3
|
|
4
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
5
|
-
static VALUE CEncoding_UTF_8;
|
6
|
-
static ID i_encoding, i_encode;
|
7
|
-
#endif
|
8
|
-
|
9
4
|
static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
|
10
5
|
mHash, mArray,
|
11
6
|
#ifdef RUBY_INTEGER_UNIFICATION
|
@@ -15,8 +10,7 @@ static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
|
|
15
10
|
#endif
|
16
11
|
mFloat, mString, mString_Extend,
|
17
12
|
mTrueClass, mFalseClass, mNilClass, eGeneratorError,
|
18
|
-
eNestingError
|
19
|
-
i_SAFE_STATE_PROTOTYPE;
|
13
|
+
eNestingError;
|
20
14
|
|
21
15
|
static ID i_to_s, i_to_json, i_new, i_indent, i_space, i_space_before,
|
22
16
|
i_object_nl, i_array_nl, i_max_nesting, i_allow_nan, i_ascii_only,
|
@@ -620,13 +614,18 @@ static size_t State_memsize(const void *ptr)
|
|
620
614
|
return size;
|
621
615
|
}
|
622
616
|
|
617
|
+
#ifndef HAVE_RB_EXT_RACTOR_SAFE
|
618
|
+
# undef RUBY_TYPED_FROZEN_SHAREABLE
|
619
|
+
# define RUBY_TYPED_FROZEN_SHAREABLE 0
|
620
|
+
#endif
|
621
|
+
|
623
622
|
#ifdef NEW_TYPEDDATA_WRAPPER
|
624
623
|
static const rb_data_type_t JSON_Generator_State_type = {
|
625
624
|
"JSON/Generator/State",
|
626
625
|
{NULL, State_free, State_memsize,},
|
627
626
|
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
628
627
|
0, 0,
|
629
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
628
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE,
|
630
629
|
#endif
|
631
630
|
};
|
632
631
|
#endif
|
@@ -944,7 +943,7 @@ static void generate_json_string(FBuffer *buffer, VALUE Vstate, JSON_Generator_S
|
|
944
943
|
fbuffer_append_char(buffer, '"');
|
945
944
|
#ifdef HAVE_RUBY_ENCODING_H
|
946
945
|
if (!enc_utf8_compatible_p(rb_enc_get(obj))) {
|
947
|
-
obj =
|
946
|
+
obj = rb_str_export_to_enc(obj, rb_utf8_encoding());
|
948
947
|
}
|
949
948
|
#endif
|
950
949
|
if (state->ascii_only) {
|
@@ -1166,8 +1165,7 @@ static VALUE cState_from_state_s(VALUE self, VALUE opts)
|
|
1166
1165
|
} else if (rb_obj_is_kind_of(opts, rb_cHash)) {
|
1167
1166
|
return rb_funcall(self, i_new, 1, opts);
|
1168
1167
|
} else {
|
1169
|
-
|
1170
|
-
return rb_funcall(prototype, i_dup, 0);
|
1168
|
+
return rb_class_new_instance(0, NULL, cState);
|
1171
1169
|
}
|
1172
1170
|
}
|
1173
1171
|
|
@@ -1499,6 +1497,10 @@ static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_l
|
|
1499
1497
|
*/
|
1500
1498
|
void Init_generator(void)
|
1501
1499
|
{
|
1500
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
1501
|
+
rb_ext_ractor_safe(true);
|
1502
|
+
#endif
|
1503
|
+
|
1502
1504
|
#undef rb_intern
|
1503
1505
|
rb_require("json/common");
|
1504
1506
|
|
@@ -1603,10 +1605,4 @@ void Init_generator(void)
|
|
1603
1605
|
i_match = rb_intern("match");
|
1604
1606
|
i_keys = rb_intern("keys");
|
1605
1607
|
i_dup = rb_intern("dup");
|
1606
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
1607
|
-
CEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
|
1608
|
-
i_encoding = rb_intern("encoding");
|
1609
|
-
i_encode = rb_intern("encode");
|
1610
|
-
#endif
|
1611
|
-
i_SAFE_STATE_PROTOTYPE = rb_intern("SAFE_STATE_PROTOTYPE");
|
1612
1608
|
}
|