jaraco / jaraco/jaraco.functools
method_cache interacts badly with subclasses
- Dominant language
- Python
- Stars
- 22
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
The implementation of `method_cache`, which sets the cached value on the instance, means that if another class attempts to override a cached method on the superclass, after the first time it's called, only the behavior in the superclass will be called.
This condition was encountered in `irc.strings.IRCFoldedCase(jaraco.text.FoldedCase)`, where `jaraco.text.FoldedCase.casefold` is cached.
I'm not sure there's anything to do here except maybe warn of the risk and provide guidance on how to navigate the concern.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the method_cache implementation and trace the interaction between jaraco.text.FoldedCase.casefold and irc.strings.IRCFoldedCase. Reproduce the superclass/subclass behavior, then establish whether the issue should be addressed by changing the implementation or by adding the warning and guidance described in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100