Skip to content

v1.0.1

Choose a tag to compare

@torchlens-release torchlens-release released this 23 Mar 01:31
· 6 commits to main since this release

v1.0.1 (2026-03-23)

This release is published under the GPL-3.0-only License.

Bug Fixes

  • decoration: Clear stale sq_item C slot after wrapping Tensor.getitem (b2c6085)

When getitem is replaced on a C extension type with a Python function, CPython sets the sq_item slot in tp_as_sequence. This makes PySequence_Check(tensor) return True (was False in clean PyTorch), causing torch.tensor([0-d_tensor, ...]) to iterate elements as sequences and call len() -- which raises TypeError for 0-d tensors. The slot is never cleared by restoring the original wrapper_descriptor or by delattr.

Fix: null sq_item via ctypes after every decoration/undecoration cycle (decorate_all_once, unwrap_torch, wrap_torch). Safe because tensor indexing uses mp_subscript (mapping protocol), not sq_item (sequence protocol). Verified via tp_name guard; fails silently on non-CPython.

Adds 9 regression tests covering all lifecycle paths.

Chores

  • Add secret detection pre-commit hooks (0e2889a)

Add detect-private-key (pre-commit-hooks) and detect-secrets (Yelp) to catch leaked keys, tokens, and high-entropy strings before they hit the repo.


Detailed Changes: v1.0.0...v1.0.1