Skip to content

Scope cached method results to receiver and function identity - #1544

Merged
SkBlaz merged 1 commit into
masterfrom
fix/daily-bugscan-20261006
Oct 6, 2026
Merged

SkBlaz merged 1 commit into
masterfrom
fix/daily-bugscan-20261006

Conversation

@SkBlaz

@SkBlaz SkBlaz commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Cached methods on different receivers currently share results when their method names and arguments match. For example, two networks returning degrees 3 and 8 both return 3 when using the same CacheManager. Distinct decorated functions with the same name also collide.

Scope each cache key to the decorated function and receiver identity in addition to the existing argument digest. Identity keys support equal and unhashable receivers and retain the receiver until its entry is evicted or cleared, preventing object-ID reuse. Named cache sizes and invalidation behavior are preserved. Document the receiver lifetime in AGENTS.md.

Validation:

  • All 7 new regression cases fail against unchanged master.
  • All 33 regression and existing lazy-evaluation tests pass on Python 3.12 and Python 3.9.
  • Focused Ruff F/B checks and git diff --check pass.

@SkBlaz
SkBlaz merged commit 333eaba into master Oct 6, 2026
39 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.

1 participant