Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize cached_method when wrapping no-arg methods (#6381)
Previously, the first time a no-arg cached method was called the decorator would make three calls: `hasattr`, `object.__setattr__`, `getattr`, and when called subsequently it would make two calls: `hasattr`, `getattr`. Here we refactor the implementation to use a sentinel value so that on the first call we only make two calls: `getattr`, `object.__setattr__`, and when called subsequently we only make a single `getattr` call.
- Loading branch information