smarter_json 1.2.5 → 1.2.6
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/CHANGELOG.md +8 -0
- data/ext/smarter_json/smarter_json.c +5 -1
- data/lib/smarter_json/parser.rb +8 -4
- data/lib/smarter_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: d7ded6a0b9872aaa577e5a8381ed69c5eeb89056a05eaa82a253228b1456c2b9
|
|
4
|
+
data.tar.gz: 5fb399f6c8ae40528d521182b02b4e156734c436b70e3cbd662b832ad339f245
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c87d064c656210698c3fd0307bd2673861105e1be998e0770a6833cc7c7bd9658c329b19c5866d87bb23db11fc2dec13a25b8007417fa634ed2fe6ab4d71624
|
|
7
|
+
data.tar.gz: 959b5022a439414a101285ee4d3480e8ca011c1d9293eac911024f9748b574bda1a108b280d529118b5e572fcd1dd633a9ef4ca89d0bea5e07823135868a5e2c
|
data/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
> ⚠️ We discourage the use of `process(input).first` / `process(input)[0]` because it silently drops potential additional documents
|
|
14
14
|
> Please use `process_one` if you are expecting only one JSON doc, e.g. in API payloads, because it emits on_warning if it finds multiple docs.
|
|
15
15
|
|
|
16
|
+
## 1.2.6 (2026-07-02)
|
|
17
|
+
|
|
18
|
+
RSpec tests: 1,308 → 1,325
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- **The `:number_overflow` warning now reports the sign of the collapsed value.** A negative number literal beyond Float range (e.g. `-1e400`) collapses to `-Infinity`, but the warning said "collapsed to Infinity" — always on the C path, and for top-level numbers on the pure-Ruby path. Both paths now report the actual collapsed value (`Infinity` or `-Infinity`) in every position, and the warning-parity suite locks them together.
|
|
23
|
+
|
|
16
24
|
## 1.2.5 (2026-07-01)
|
|
17
25
|
|
|
18
26
|
RSpec tests: 1,282 → 1,308
|
|
@@ -649,7 +649,11 @@ static FJ_ALWAYS_INLINE VALUE fj_float_from_parts(fj_state *st, uint64_t m10, in
|
|
|
649
649
|
still returned). The Infinity/NaN keywords take separate paths and never get here.
|
|
650
650
|
Gate isinf on a listening handler (matches the Ruby float_or_warn): no handler ->
|
|
651
651
|
no point detecting, and it keeps the test off the hot number path. */
|
|
652
|
-
if (st->on_warning != Qnil && isinf(d))
|
|
652
|
+
if (st->on_warning != Qnil && isinf(d)) {
|
|
653
|
+
fj_warn(st, fj_sym_number_overflow,
|
|
654
|
+
d > 0 ? "number literal out of Float range — collapsed to Infinity"
|
|
655
|
+
: "number literal out of Float range — collapsed to -Infinity");
|
|
656
|
+
}
|
|
653
657
|
return rb_float_new(d);
|
|
654
658
|
}
|
|
655
659
|
|
data/lib/smarter_json/parser.rb
CHANGED
|
@@ -1925,6 +1925,7 @@ module SmarterJSON
|
|
|
1925
1925
|
# --- numbers (top-level / strict positions) ---
|
|
1926
1926
|
|
|
1927
1927
|
def parse_number
|
|
1928
|
+
token_start = @pos
|
|
1928
1929
|
negative = false
|
|
1929
1930
|
signed = false
|
|
1930
1931
|
if byte == MINUS
|
|
@@ -1945,7 +1946,6 @@ module SmarterJSON
|
|
|
1945
1946
|
return Float::NAN
|
|
1946
1947
|
end
|
|
1947
1948
|
|
|
1948
|
-
int_start = @pos
|
|
1949
1949
|
had_leading_zero = false
|
|
1950
1950
|
|
|
1951
1951
|
if byte == ZERO
|
|
@@ -2001,9 +2001,13 @@ module SmarterJSON
|
|
|
2001
2001
|
raise error("invalid number with a leading zero")
|
|
2002
2002
|
end
|
|
2003
2003
|
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2004
|
+
# token_start sits BEFORE the sign, so the slice keeps it ("-1e400", not "1e400"):
|
|
2005
|
+
# decimal_value -> float_or_warn sees the signed token, and a negative overflow
|
|
2006
|
+
# warns "collapsed to -Infinity" — the same warning numeric_value produces for a
|
|
2007
|
+
# member-position number. String#to_i, String#to_f, and BigDecimal() all parse
|
|
2008
|
+
# the leading sign, so there is no negation step here.
|
|
2009
|
+
slice = @input.byteslice(token_start, @pos - token_start).delete("_")
|
|
2010
|
+
is_float ? decimal_value(slice) : slice.to_i
|
|
2007
2011
|
end
|
|
2008
2012
|
|
|
2009
2013
|
def hex_digit?(b)
|
data/lib/smarter_json/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smarter_json
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tilo Sloboda
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-07-
|
|
10
|
+
date: 2026-07-03 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: bigdecimal
|