-
Notifications
You must be signed in to change notification settings - Fork 536
fix: Deepcopy flag buffer on scope fork #3882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
@antonpirker Re-ran the test and this is now passing. Has |
@@ -91,13 +89,6 @@ def __init__(self, max_size): | |||
|
|||
self.hits = self.misses = 0 | |||
|
|||
def __copy__(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you remove this method entirely, aren't we back at square one? I.e. the cache will get polluted by changes to a copy:
def test_mutate():
cache = LRUCache(1)
cache.set(0, 0)
copy(cache).set(0, 1)
assert cache.get(0) == 0 # fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because the call site is now using deepcopy. Which targets the dunder deepcopy method which we leave as default.
Closing this in favor of solution linked here: #3852 |
A previous attempt to fix this issue focused on a related issue and assumed that it would fix this. This PR adds a test using the reproduction steps mentioned in the bug report and fixes the issue by deep copying the buffer.
Closes: #3852