Skip to content

Invalidate entries shared by native method wrappers - #76

Merged
dgilland merged 1 commit into
dgilland:masterfrom
Aschenbath:fix/oss-20-20261125-77d1-cacheout-builtin-invalidate
Nov 25, 2026
Merged

dgilland merged 1 commit into
dgilland:masterfrom
Aschenbath:fix/oss-20-20261125-77d1-cacheout-builtin-invalidate

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

Repeated wrappers of a native bound method, such as cache.memoize()(values.count), share memoization keys. However, calling invalidate() through the second wrapper leaves the first wrapper's entries behind, so mutating values can continue to return a stale result.

Recognize equal built-in and slot-method wrappers during invalidation. Equality is restricted to the same native callable type; entries belonging to another receiver or method stay intact. This also removes entries across typed/untyped wrappers of the same native method.

Validation on Windows:

  • All 6 new regression cases fail on unchanged master and pass with the fix.
  • Full suite: 423 tests pass with 100% coverage on Python 3.10, 3.11, 3.12, 3.13, and 3.14.
  • Ruff lint/format, mypy, package build, and Sphinx with warnings treated 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-20261125-77d1-cacheout-builtin-invalidate into dgilland:master

@dgilland
dgilland merged commit 7ee0fce 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