Skip to content
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

Merged
merged 5 commits into from
Dec 4, 2016
Merged

Fixes the cache bug. #782

merged 5 commits into from
Dec 4, 2016

Conversation

drvinceknight
Copy link
Member

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).

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).
@drvinceknight drvinceknight mentioned this pull request Dec 4, 2016
key: tuple
A 3-tuple: (player instance, player instance, match length)
"""
return key[0].name, key[1].name, key[2]
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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)

@drvinceknight
Copy link
Member Author

@meatballs I'm merging this under the bug fix rule.

@drvinceknight drvinceknight merged commit 4dd83e4 into master Dec 4, 2016
@marcharper marcharper deleted the 779 branch December 8, 2016 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants