Commit graph

9854 commits

Author SHA1 Message Date
Sutou Kouhei
af6d6b64ea [ruby/strscan] named_captures: fix incompatibility with
MatchData#named_captures
(https://github.com/ruby/strscan/pull/146)

Fix https://github.com/ruby/strscan/pull/145

`MatchData#named_captures` use the last matched value for each name.

Reported by Linus Sellberg. Thanks!!!

a6086ea322
2025-05-02 09:52:38 +09:00
nick evans
a1e627b7e3
[ruby/psych] Use rb_struct_initialize to initialize Data
3573fb356e
2025-05-02 09:49:15 +09:00
Sam Rawlins
3176cd6993 [ruby/psych] fix error in @dispatch_catch
9df5501fdc
2025-05-01 17:54:18 +00:00
nick evans
136dc52663 Add support for Data objects with ivars
This sets the ivars _before_ calling initialize, which feels wrong.  But
Data doesn't give us any mechanism for setting the members other than 1)
initialize, or 2) drop down into the C API.  Since initialize freezes
the object, we need to set the ivars before that.  I think this is a
reasonable compromise—if users need better handling, they can implement
their own `encode_with` and `init_with`.  But it will lead to unhappy
surprises for some users.

Alternatively, we could use the C API, similarly to Marshal.  Psych _is_
already using the C API for path2class and build_exception.  This would
be the least surprising behavior for users, I think.
2025-05-01 17:52:14 +00:00
nick evans
a397e4d4b0 [ruby/psych] Add support for ruby 3.2 Data objects
788b844c83
2025-05-01 17:52:13 +00:00
Martin Meyerhoff
bd1d6e8cd7 [ruby/psych] Fix loading/parsing regular expressions
This fixes the issue where regular expression would come back slightly
different after going through a YAML load/dump cycle. Because we're used
to having to escape forward slashes in regular expression literals
(because the literal is delimited by slashes), but the deserializer
takes the literal output from `Regexp#inspect` and feeds it as a string
into `Regexp.new`, which expects a string, not a Regexp literal, cycling
did not properly work before this commit.

I've also changed the code to be a bit more readable, I hope this
doesn't affect performance.

f4dd8dadad
2025-05-01 17:50:13 +00:00
Aaron Patterson
b63c4d14f2 [ruby/psych] Bump version for release
bb63f91825
2025-05-01 16:34:09 +00:00
Jean Boussier
de6e59e5ba Sync ruby/json
Fix: https://github.com/ruby/json/issues/796
2025-05-01 10:06:04 +02:00
Jean Boussier
f55138c9e7 [ruby/psych] Handle Ruby 3.5 new Set class
Since `Set` no longer is a regular object class holding a Hash
it needs to be specially handled.

c2d185d27c
2025-04-30 18:31:33 +00:00
Jean Boussier
6e7825316e [ruby/json] Remove explicit include of extconf.h
6b059900de

.
2025-04-30 08:12:41 +02:00
Jean Boussier
6ba0dc4d97 [ruby/json] Fix --with-static-linked-ext builds
d7d60cccb0
2025-04-30 08:12:41 +02:00
Jean Boussier
338adad8ba [ruby/json] Fix i686 builds
We should test compilation with `-msse2` because we need to
test with whatever arguments Ruby will be compiled with.

0a871365db
2025-04-30 08:12:41 +02:00
Jean Boussier
b5beed45a2 [ruby/json] SIMD: Match control char and double quote in one pass
`c < 32 || c == 34` is equivalent to `c ^ 2 < 33`.

Found in: https://lemire.me/blog/2025/04/13/detect-control-characters-quotes-and-backslashes-efficiently-using-swar/

The gain seem mostly present on micro-benchmark, and even there aren't
very consistent, but it's never slower.

```
== Encoding long string (124001 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     5.295k i/100ms
Calculating -------------------------------------
               after     55.796k (± 3.4%) i/s   (17.92 μs/i) -    280.635k in   5.035690s

Comparison:
              before:    49840.7 i/s
               after:    55795.8 i/s - 1.12x  faster
```

034c5debd8
2025-04-30 08:12:41 +02:00
Jean Boussier
b7d1e33f26 Update ext/json/generator/depend 2025-04-30 08:12:41 +02:00
Scott Myron
a3ec53bbb0 [ruby/json] Introduce ARM Neon and SSE2 SIMD.
(https://github.com/ruby/json/pull/743)

See the pull request for the long development history: https://github.com/ruby/json/pull/743

```
== Encoding activitypub.json (52595 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     2.913k i/100ms
Calculating -------------------------------------
               after     29.377k (± 2.0%) i/s   (34.04 μs/i) -    148.563k in   5.059169s

Comparison:
              before:    23314.1 i/s
               after:    29377.3 i/s - 1.26x  faster

== Encoding citm_catalog.json (500298 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   152.000 i/100ms
Calculating -------------------------------------
               after      1.569k (± 0.8%) i/s  (637.49 μs/i) -      7.904k in   5.039001s

Comparison:
              before:     1485.6 i/s
               after:     1568.7 i/s - 1.06x  faster

== Encoding twitter.json (466906 bytes)
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   309.000 i/100ms
Calculating -------------------------------------
               after      3.115k (± 3.1%) i/s  (321.01 μs/i) -     15.759k in   5.063776s

Comparison:
              before:     2508.3 i/s
               after:     3115.2 i/s - 1.24x  faster
```

49003523da
2025-04-30 08:12:41 +02:00
Jean Boussier
7f0c6d30d3 [ruby/json] Use RB_TYPE_P
b14250f1da
2025-04-30 08:12:41 +02:00
Jean Boussier
5566a7f740 [ruby/json] Handle non-string keys returning immediate values via to_s
We can't directly call `RBASIC_CLASS` as the return value of
`to_s` may be an immediate.

12dc394d11
2025-04-30 08:12:41 +02:00
Jean Boussier
1103611600 [ruby/json] Release 2.11.3
3e025f76d7
2025-04-30 08:12:41 +02:00
Jean Boussier
8fe3fb5d5a [ruby/json] Stop caching the generator state pointer
Fix: https://github.com/ruby/json/issues/790

If we end up calling something that spills the state
on the heap, the pointer we received is outdated and
may be out of sync.

2ffa4ea46b
2025-04-30 08:12:41 +02:00
Jean Boussier
3ec7bfff2e Use a set_table for rb_vm_struct.unused_block_warning_table
Now that we have a hash-set implementation we can use that
instead of a hash-table with a static value.
2025-04-27 11:59:28 +02:00
Jean Boussier
db66038285 [ruby/json] Release 2.11.2
c985e8c6ea
2025-04-25 11:11:22 +09:00
Jean Boussier
05f949ebbf [ruby/json] Bring back JSON::PRETTY_STATE_PROTOTYPE with a deprecation
Fix: https://github.com/ruby/json/issues/788

`multi_json` rely on it, even though it was never documented as
public API.

Bringing it back as a method so it can emit a deprecation warning.

123121bba2
2025-04-25 11:11:21 +09:00
Jean Boussier
1d65d5ce47 [ruby/json] Release 2.11.1
84443e881d
2025-04-25 11:11:20 +09:00
Jean Boussier
2b5e1db2db [ruby/json] Bring back the numerous deprecated alias
This time with explicit deprecation warnings.

0dee9bdad9
2025-04-25 11:11:19 +09:00
Jean Boussier
169b33d1d5 [ruby/json] Release 2.11.0
a6949f8656
2025-04-25 11:11:18 +09:00
Hiroshi SHIBATA
4634a0042e
Mark development version for unreleased gems 2025-04-22 11:27:24 +09:00
Sutou Kouhei
067fc410fc
[ruby/strscan] Bump version
8ff80150c4
2025-04-22 11:27:24 +09:00
Jean Boussier
e0264791f0
[ruby/json] Get rid of unused CircularDatastructure class
92beca8032
2025-04-22 11:27:24 +09:00
Sutou Kouhei
6962f3dc29 [ruby/stringio] Development of 3.1.8 started.
14fbdcc02c
2025-04-21 02:40:31 +00:00
Sutou Kouhei
f8c20cc45d [ruby/stringio] Development of 3.1.7 started.
ee3ee1df31
2025-04-21 02:38:57 +00:00
Kazuki Yamaguchi
93afcfcde3 [ruby/openssl] asn1: check for missing EOC in indefinite length encoding
EOC octets are required at the end of contents of a constructed encoding
that uses the indefinite length form. This cannot be assumed from the
end of the input. Raise an exception when necessary.

bc20c13a7c
2025-04-20 07:41:15 +00:00
YO4
0db1f47ad0 [ruby/resolv] quote registry value name properly
'NV Domain' needs to be quoted.

332a16dcc0
2025-04-17 23:48:55 +00:00
Samuel Williams
06a7b3c144
Only test on known good platforms. (#13123) 2025-04-17 16:19:05 +00:00
Samuel Williams
c4ae6cb500
Prefer th->ec for stack base/size. (#13101) 2025-04-17 13:21:51 +00:00
Kazuki Yamaguchi
0a8a641d0a [ruby/openssl] ssl: fix SSLSocket#syswrite with String-convertible objects
Correctly pass the new object assigned by StringValue() to
ossl_ssl_write_internal_safe().

This is a follow-up to commit 0d8c17aa85 (Reduce
OpenSSL::Buffering#do_write overhead, 2024-12-21).

3ff096196a
2025-04-16 15:16:50 +00:00
Samuel Williams
28491e53cd [ruby/stringio] Support for rb_io_mode_t
(https://github.com/ruby/stringio/pull/129)

Companion PR to <https://github.com/ruby/ruby/pull/7894>.

2d3988e12f
2025-04-15 11:15:35 +00:00
Jean Boussier
77a52787a6 [ruby/json] Cleanup Kernel#JSON
573ebdca89
2025-04-15 16:48:22 +09:00
Jean Boussier
26a9ccbf83 [ruby/json] Deprecate Kernel#j and Kernel#jj
27155b6500
2025-04-15 16:48:22 +09:00
Jean Boussier
1afc539900 [ruby/json] Get rid of JSONError.wrap
3e7e661ef5
2025-04-15 16:48:21 +09:00
Jean Boussier
62b7ae955a [ruby/json] Don't create custom NaN and Infinity objects.
ff8e18392d
2025-04-15 16:48:20 +09:00
Sutou Kouhei
ad8cb532d5 [ruby/strscan] Bump version
7b1eb1e4ed
2025-04-14 16:18:48 +09:00
Jean byroot Boussier
0db87b8943 [ruby/strscan] Allow parsing strings larger than 2GiB
(https://github.com/ruby/strscan/pull/147)

For a reason unknown, even though `pos` is stored as a `long`, the
`#pos` and `#pos=` treat it as an `int`, which prevent seeking into
strings larger than 2GiB.

b76368416e

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-04-14 16:18:47 +09:00
Nobuyoshi Nakada
311167ee3a [ruby/etc] Suppress unused function warning
410c8dd4ae
2025-04-13 22:03:59 +00:00
Nobuyoshi Nakada
6d00fa2270 [ruby/etc] Check members only for defined structs
15c2696794
2025-04-13 22:03:59 +00:00
Haruna Tsujita
3700ae2e99
Fix typos finised -> finished (#13104) 2025-04-13 20:46:40 +09:00
Jean Boussier
ae45a7a952 [ruby/json] Cleanup jeaiii-ltoa to not need pragmas
97f2924d0a
2025-04-09 08:11:03 +09:00
Nobuyoshi Nakada
b1362e26c7 [ruby/json] Suppress -Wunknown-pragmas warnings
97f47d1cfd
2025-04-09 08:11:03 +09:00
John Hawthorn
5eb3efcf2d Fix timeline_value not being marked in test
T_DATA with a NULL pointer are not marked. Let's wrap 1 instead to
ensure that our mark function is actually run.
2025-04-03 10:39:47 -07:00
Jean Boussier
580aa60051 Improve backtrace of errors raised by Socket.tcp_with_fast_fallback
[Bug #21211]

Socket errors raised from background threads are hard to track down because
their backtrace starts from the spawned thread.

To solve this we can raise a new error with the old one as `cause`.
2025-04-02 13:24:22 +02:00
Hiroshi SHIBATA
502fcfcc46
stringio-3.1.6 has been released 2025-03-31 16:13:46 +09:00