File: 0001-No-google-crc32c.patch

package info (click to toggle)
zarr 3.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,068 kB
  • sloc: python: 31,589; makefile: 10
file content (43 lines) | stat: -rw-r--r-- 1,821 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sat, 22 Nov 2025 17:28:20 +0000
Subject: No google-crc32c

Forwarded: not-needed
---
 src/zarr/codecs/crc32c_.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/zarr/codecs/crc32c_.py b/src/zarr/codecs/crc32c_.py
index 9536d0d..6cdc169 100644
--- a/src/zarr/codecs/crc32c_.py
+++ b/src/zarr/codecs/crc32c_.py
@@ -3,7 +3,8 @@ from __future__ import annotations
 from dataclasses import dataclass
 from typing import TYPE_CHECKING, cast
 
-import google_crc32c
+# import google_crc32c
+from crc32c import crc32c
 import numpy as np
 import typing_extensions
 
@@ -42,7 +43,8 @@ class Crc32cCodec(BytesBytesCodec):
 
         # Need to do a manual cast until https://github.com/numpy/numpy/issues/26783 is resolved
         computed_checksum = np.uint32(
-            google_crc32c.value(cast("typing_extensions.Buffer", inner_bytes))
+                # google_crc32c.value(cast("typing_extensions.Buffer", inner_bytes))
+                crc32c(cast("typing_extensions.Buffer", inner_bytes))
         ).tobytes()
         stored_checksum = bytes(crc32_bytes)
         if computed_checksum != stored_checksum:
@@ -59,7 +61,8 @@ class Crc32cCodec(BytesBytesCodec):
         data = chunk_bytes.as_numpy_array()
         # Calculate the checksum and "cast" it to a numpy array
         checksum = np.array(
-            [google_crc32c.value(cast("typing_extensions.Buffer", data))], dtype=np.uint32
+            # [google_crc32c.value(cast("typing_extensions.Buffer", data))], dtype=np.uint32
+            [crc32c(cast("typing_extensions.Buffer", data))], dtype=np.uint32
         )
         # Append the checksum (as bytes) to the data
         return chunk_spec.prototype.buffer.from_array_like(np.append(data, checksum.view("B")))