-
Notifications
You must be signed in to change notification settings - Fork 263
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
Fixes the cache bug. #782
Fixes the cache bug. #782
Conversation
Closes #779 This makes the underlying read/write of the cache be the string repr. The passed key is the player instances (as opposed to previously going to have to go get the class).
key: tuple | ||
A 3-tuple: (player instance, player instance, match length) | ||
""" | ||
return key[0].name, key[1].name, key[2] |
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.
Can we check if the player has been instantiated? This could still fail in the same way, no?
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.
This is assuming that key[0]
and key[1]
are instance of the Player class. I have modified the valid key check to check that that's indeed the case.
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.
def _is_valid_key(self, key):
 """Validate a proposed dictionary key
@@ -85,8 +103,8 @@ def _is_valid_key(self, key):
 # integer
 try:
 if not (
 - issubclass(key[0], Player) and
 - issubclass(key[1], Player) and
 + isinstance(key[0], Player) and
 + isinstance(key[1], Player) and
 isinstance(key[2], int)
@meatballs I'm merging this under the bug fix rule. |
Closes #779
This makes the underlying read/write of the cache be the string repr.
The passed key is the player instances (as opposed to previously going
to have to go get the class).