forked from getsentry/sentry-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cache pollution from mutable reference (getsentry#3887)
- Removes manual overrides of copy behavior and leaves it up to the caller. - E.g. a future use case may require a non-deepcopy. If we override copy they would have to remove the dunder copy, update every implementation which relies copy, before finally creating their own copy implementation. - Deepcopies the flag buffer. - Though we do not cache mutable references yet we may soon and so this foot gun should be removed from possibility. - Removes "copy" test coverage from `test_lru_cache.py`. We're no longer assuming copy usage and leave it up to the caller. - The existing test in `tests/test_scope.py` covers the cache pollution case [originally mentioned here](getsentry#3852). - The mutable cache pollution case is not covered because we do not currently cache mutable objects. In general a generic class should assume as few implementation details as possible. If we leave the existing copy method someone may assume copy semantics and rely on it in a way that is inappropriate. Closes: getsentry#3886 Co-authored-by: Anton Pirker <[email protected]>
- Loading branch information
1 parent
c3516db
commit bb85c26
Showing
4 changed files
with
2 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters