CodeSampleX

Ejemplo

numpy 2.5.2: Prevent silent numeric narrowing with NumPy 2.5.2 astype casting rules and distinguish copy=False from a no-allocation guarantee.

Muestra verificada para pypi numpy 2.5.2: Prevent silent numeric narrowing with NumPy 2.5.2 astype casting rules and distinguish copy=False from a…

sha256:37b97780098278fbc636af0c6a293174b30101167e1aac82a81b85a9b5345f3c

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
2
Claves de firma que lo compilaron
2
Entorno declarado python 3.12 linux x64 python 3.12 python pip

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-17
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

Caso

HOW
Objetivo
Prevent silent numeric narrowing with NumPy 2.5.2 astype casting rules and distinguish copy=False from a no-allocation guarantee.
Paquetes
Símbolos
  • numpy.array
  • numpy.array_equal
  • numpy.ndarray.astype
  • numpy.shares_memory
Entorno
python 3.12
Creado
2026-08-17T02:13:42Z

Contrato

  1. astype(casting='same_kind') accepts int64-to-int8 narrowing and wraps out-of-range values instead of checking them.
  2. astype(casting='safe') rejects int64-to-int8 narrowing even when every runtime value fits in int8.
  3. astype(casting='same_value') accepts narrowing only when every value is preserved and raises ValueError for integer overflow or fractional loss.
  4. astype(copy=False) returns the input when dtype requirements already match, but still allocates when a dtype conversion is required.

Archivos

  • NOTES.md
  • csx.json
  • requirements.in
  • requirements.txt
  • test/contract.py

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

csx-seed