json 2.7.3 → 2.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/ext/json/ext/generator/generator.c +11 -0
- data/lib/json/ext.rb +0 -3
- data/lib/json/pure/parser.rb +14 -14
- data/lib/json/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c75f2746cbbd315a24997d2bf37e0284a9b21a99d43d7a5abf35369415f9ed9f
|
4
|
+
data.tar.gz: 57c78c979d0aad97c7d8a7d8602ea7c47824f1a62f8335681ea2803a62b09fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb3fc2fe76bbcdde8f1dd6a501e8868c0cc8be64a59841ef3ffe436e1b8f99fbc0a4fe383c200531a722c21097f9c925d71fba1320c0d181abe45c6f7c74291
|
7
|
+
data.tar.gz: 739a9039ed42e1ddb4a5ca37a96e23485bc3383bd11c557f83bc63df16e0366bdc15cca886ffa041f3cb46a87010dd69657c2df54eefaa89597a8a4b8c6ff6bd
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
### 2024-10-25 (2.7.4)
|
4
|
+
|
5
|
+
* Workaround a bug in 3.4.8 and older https://github.com/rubygems/rubygems/pull/6490.
|
6
|
+
This bug would cause some gems with native extension to fail during compilation.
|
7
|
+
* Workaround different versions of `json` and `json_pure` being loaded (not officially supported).
|
8
|
+
* Make `json_pure` Ractor compatible.
|
9
|
+
|
3
10
|
### 2024-10-24 (2.7.3)
|
4
11
|
|
5
12
|
* Numerous performance optimizations in `JSON.generate` and `JSON.dump` (up to 2 times faster).
|
@@ -963,6 +963,12 @@ static VALUE cState_generate(VALUE self, VALUE obj)
|
|
963
963
|
return result;
|
964
964
|
}
|
965
965
|
|
966
|
+
static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
|
967
|
+
{
|
968
|
+
rb_warn("The json gem extension was loaded with the stdlib ruby code. You should upgrade rubygems with `gem update --system`");
|
969
|
+
return self;
|
970
|
+
}
|
971
|
+
|
966
972
|
/*
|
967
973
|
* call-seq: initialize_copy(orig)
|
968
974
|
*
|
@@ -1408,6 +1414,9 @@ void Init_generator(void)
|
|
1408
1414
|
cState = rb_define_class_under(mGenerator, "State", rb_cObject);
|
1409
1415
|
rb_define_alloc_func(cState, cState_s_allocate);
|
1410
1416
|
rb_define_singleton_method(cState, "from_state", cState_from_state_s, 1);
|
1417
|
+
rb_define_method(cState, "initialize", cState_initialize, -1);
|
1418
|
+
rb_define_alias(cState, "initialize", "initialize"); // avoid method redefinition warnings
|
1419
|
+
|
1411
1420
|
rb_define_method(cState, "initialize_copy", cState_init_copy, 1);
|
1412
1421
|
rb_define_method(cState, "indent", cState_indent, 0);
|
1413
1422
|
rb_define_method(cState, "indent=", cState_indent_set, 1);
|
@@ -1498,4 +1507,6 @@ void Init_generator(void)
|
|
1498
1507
|
usascii_encindex = rb_usascii_encindex();
|
1499
1508
|
utf8_encindex = rb_utf8_encindex();
|
1500
1509
|
binary_encindex = rb_ascii8bit_encindex();
|
1510
|
+
|
1511
|
+
rb_require("json/ext/generator/state");
|
1501
1512
|
}
|
data/lib/json/ext.rb
CHANGED
@@ -15,9 +15,6 @@ module JSON
|
|
15
15
|
else
|
16
16
|
require 'json/ext/parser'
|
17
17
|
require 'json/ext/generator'
|
18
|
-
unless RUBY_ENGINE == 'jruby'
|
19
|
-
require 'json/ext/generator/state'
|
20
|
-
end
|
21
18
|
$DEBUG and warn "Using Ext extension for JSON."
|
22
19
|
JSON.parser = Parser
|
23
20
|
JSON.generator = Generator
|
data/lib/json/pure/parser.rb
CHANGED
@@ -148,25 +148,25 @@ module JSON
|
|
148
148
|
end
|
149
149
|
|
150
150
|
# Unescape characters in strings.
|
151
|
-
UNESCAPE_MAP =
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
})
|
151
|
+
UNESCAPE_MAP = {
|
152
|
+
'"' => '"',
|
153
|
+
'\\' => '\\',
|
154
|
+
'/' => '/',
|
155
|
+
'b' => "\b",
|
156
|
+
'f' => "\f",
|
157
|
+
'n' => "\n",
|
158
|
+
'r' => "\r",
|
159
|
+
't' => "\t",
|
160
|
+
'u' => nil,
|
161
|
+
}.freeze
|
163
162
|
|
164
163
|
STR_UMINUS = ''.respond_to?(:-@)
|
165
164
|
def parse_string
|
166
165
|
if scan(STRING)
|
167
166
|
return '' if self[1].empty?
|
168
|
-
string = self[1].gsub(%r(
|
169
|
-
|
167
|
+
string = self[1].gsub(%r{(?:\\[\\bfnrt"/]|(?:\\u(?:[A-Fa-f\d]{4}))+|\\[\x20-\xff])}n) do |c|
|
168
|
+
k = $&[1]
|
169
|
+
if u = UNESCAPE_MAP.fetch(k) { k.chr }
|
170
170
|
u
|
171
171
|
else # \uXXXX
|
172
172
|
bytes = ''.b
|
data/lib/json/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a JSON implementation as a Ruby extension in C.
|
14
14
|
email: flori@ping.de
|