Skip to content

Memoize unhashable memoryview arguments by identity - #83

Merged
dgilland merged 1 commit into
dgilland:masterfrom
Aschenbath:fix/oss-20-more-20261125-77d1-memoryview-keys
Nov 25, 2026
Merged

dgilland merged 1 commit into
dgilland:masterfrom
Aschenbath:fix/oss-20-more-20261125-77d1-memoryview-keys

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

Memoizing a function that accepts a writable memoryview or a view with a non-byte format raises ValueError before the function runs. Python uses that exception for these unhashable views, while the key builder currently recognizes only TypeError.

Route these memoryviews through the existing identity fallback. Hashable read-only views still share equal keys, and unrelated ValueError exceptions from custom hash functions still propagate.

Validation: four regression cases fail on unchanged master. All 426 tests pass with 100% coverage on Python 3.10–3.14; Ruff, mypy, package build, and Sphinx with warnings as errors pass.

Prepared with AI assistance and verified with the checks above.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — Aschenbath:fix/oss-20-more-20261125-77d1-memoryview-keys into dgilland:master

@dgilland
dgilland merged commit 485c957 into dgilland:master Nov 25, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants