File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 11# CHANGELOG
22
33
4+ ## v1.0.1 (2026-03-23)
5+
6+ ### Bug Fixes
7+
8+ - ** decoration** : Clear stale sq_item C slot after wrapping Tensor.__ getitem__
9+ ([ ` b2c6085 ` ] ( https://github.com/johnmarktaylor91/torchlens/commit/b2c6085e31695b973b8d11c23c773af837a846cc ) )
10+
11+ When __ getitem__ is replaced on a C extension type with a Python function, CPython sets the sq_item
12+ slot in tp_as_sequence. This makes PySequence_Check(tensor) return True (was False in clean
13+ PyTorch), causing torch.tensor([ 0-d_tensor, ...] ) to iterate elements as sequences and call len()
14+ -- which raises TypeError for 0-d tensors. The slot is never cleared by restoring the original
15+ wrapper_descriptor or by delattr.
16+
17+ Fix: null sq_item via ctypes after every decoration/undecoration cycle (decorate_all_once,
18+ unwrap_torch, wrap_torch). Safe because tensor indexing uses mp_subscript (mapping protocol), not
19+ sq_item (sequence protocol). Verified via tp_name guard; fails silently on non-CPython.
20+
21+ Adds 9 regression tests covering all lifecycle paths.
22+
23+ ### Chores
24+
25+ - Add secret detection pre-commit hooks
26+ ([ ` 0e2889a ` ] ( https://github.com/johnmarktaylor91/torchlens/commit/0e2889ae90f822840895d9331e912a570d2a9acf ) )
27+
28+ Add detect-private-key (pre-commit-hooks) and detect-secrets (Yelp) to catch leaked keys, tokens,
29+ and high-entropy strings before they hit the repo.
30+
31+
432## v1.0.0 (2026-03-13)
533
634### Bug Fixes
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44
55[project ]
66name = " torchlens"
7- version = " 1.0.0 "
7+ version = " 1.0.1 "
88description = " A package for extracting activations from PyTorch models"
99readme = " README.md"
1010license = " GPL-3.0-only"
Original file line number Diff line number Diff line change 77``wrap_torch()``. The ``wrapped()`` context manager handles the full lifecycle.
88"""
99
10- __version__ = "1.0.0 "
10+ __version__ = "1.0.1 "
1111
1212# ---- Public API: user-facing entry points --------------------------------
1313
You can’t perform that action at this time.
0 commit comments