vibe_zstd 1.3.0 → 1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eb8d0ac2293ee84d588b9eb237b0c3b4623989c4db8692ad1ab325fd8047695
4
- data.tar.gz: 1732b409b13fd9e99fecb7ebf8d026f9b6d0119012641c96e66faa3d51c0f5ce
3
+ metadata.gz: f2a7e3f6643d3fd14ebce10d77ba79770d44c11cd82775de3cf2c24eaa84f118
4
+ data.tar.gz: de1a91cfa51e4e49e4759cf39449c309d28c985d2cf9085e1b6e8faed2b07e8c
5
5
  SHA512:
6
- metadata.gz: 65cc971c6400d69adaca95b0c520c8bd8ec22648bdb57218f5ac833bd0a63db6908c953b4fca127753f2257f8502b34b89eb383c38a8f315431e4051ff7a9401
7
- data.tar.gz: 836b8a52c28f8cd0d79ed4a8aa80a286f51dda58e1e483320f4544b2a63ded6e83cdccd3bfea122d267c9a44cb43dabbd2c12e69aeb69162d7d4f4ee7ecb60c3
6
+ metadata.gz: 8cb9a59f93e6167df9b7aa0a3ac466f37aae29aeb22aa191951714a694d6dc215f0f008e099f46f60c9e3941352d41c935e470e5301b9fa1cdefb980bf4372b8
7
+ data.tar.gz: 63bb4d19e418c713335da4ed48a05b11ff1af0d8ca025729234bb3416726667a0f2f75ae516918f879811dad3d7d1a2675ed605858ccfcf3b1a0934260b7a138
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.3.1] - 2026-10-26
11
+
12
+ ### Fixed
13
+ - Ruby 4.0 compatibility: `CCtx#compress`, `DCtx#decompress`, `VibeZstd.compress`/`.decompress`, and `CompressWriter#write` raised `FrozenError` when given a frozen string (including `# frozen_string_literal: true` literals). Ruby 4.0 refuses `rb_str_locktmp` on frozen strings; frozen input is already immutable, so the GVL-release lock added in 1.3.0 is now skipped for it. Unfrozen strings are still locked as before.
14
+
10
15
  ## [1.3.0] - 2026-06-11
11
16
 
12
17
  ### Security
@@ -174,10 +174,15 @@ vibe_zstd_writer_write(VALUE self, VALUE data) {
174
174
  // Lock data for the duration of the compress loop so that RSTRING_PTR(data)
175
175
  // stays valid even when io.write (called inside the loop) runs Ruby code that
176
176
  // could otherwise mutate or resize the string. rb_str_locktmp raises if the
177
- // string is already locked; the ensure always unlocks it.
178
- rb_str_locktmp(data);
179
-
177
+ // string is already locked; the ensure always unlocks it. Frozen strings
178
+ // are already immutable and Ruby 4.0+ refuses to lock them, so skip it.
180
179
  vibe_zstd_write_state state = { cstream, data };
180
+ if (OBJ_FROZEN(data)) {
181
+ vibe_zstd_writer_write_body((VALUE)&state);
182
+ return self;
183
+ }
184
+
185
+ rb_str_locktmp(data);
181
186
  rb_ensure(vibe_zstd_writer_write_body, (VALUE)&state,
182
187
  vibe_zstd_writer_write_unlock, data);
183
188
 
@@ -284,6 +284,10 @@ vibe_zstd_default_c_level(VALUE self) {
284
284
  // rb_thread_call_without_gvl can deliver a pending async exception (e.g.
285
285
  // Thread#raise, Timeout) after reacquiring the GVL, so the unlock must go
286
286
  // through rb_ensure or the string would be left permanently locked.
287
+ //
288
+ // Frozen strings are skipped: they cannot be mutated or resized, so the
289
+ // pointer is already stable, and Ruby 4.0+ raises FrozenError from
290
+ // rb_str_locktmp on a frozen string.
287
291
  typedef struct {
288
292
  void* (*func)(void*);
289
293
  void* arg;
@@ -305,6 +309,10 @@ nogvl_locked_unlock(VALUE str) {
305
309
  static void
306
310
  vibe_zstd_nogvl_with_str_locked(void* (*func)(void*), void* arg, VALUE str) {
307
311
  nogvl_locked_call call = { func, arg };
312
+ if (OBJ_FROZEN(str)) {
313
+ nogvl_locked_body((VALUE)&call);
314
+ return;
315
+ }
308
316
  rb_str_locktmp(str);
309
317
  rb_ensure(nogvl_locked_body, (VALUE)&call, nogvl_locked_unlock, str);
310
318
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VibeZstd
4
- VERSION = "1.3.0"
4
+ VERSION = "1.3.1"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vibe_zstd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelley Reynolds
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-06-12 00:00:00.000000000 Z
10
+ date: 2026-10-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: benchmark-ips