From 95d675b66c3aeb85347474c1ea56b07d828efc0e Mon Sep 17 00:00:00 2001 From: notoraptor Date: Thu, 25 Oct 2018 11:21:02 -0400 Subject: PriorityDict - Removed infinite recursion in Python 3.6.7 --- diplomacy/utils/priority_dict.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'diplomacy/utils') diff --git a/diplomacy/utils/priority_dict.py b/diplomacy/utils/priority_dict.py index 99a75c9..acef8f9 100644 --- a/diplomacy/utils/priority_dict.py +++ b/diplomacy/utils/priority_dict.py @@ -71,7 +71,7 @@ class PriorityDict(dict): def smallest(self): """ Finds the smallest item in the priority dict - :return: A tuple of (priority, key) for the item with the smallest priority + :return: A tuple of (priority, key) for the item with the smallest priority, or None if dict is empty. """ while self.__heap and not self.__heap[0][-1]: heapq.heappop(self.__heap) @@ -87,7 +87,7 @@ class PriorityDict(dict): """ Return a copy of this priority dict. :rtype: PriorityDict """ - return PriorityDict(**self) + return PriorityDict(**{key: entry[0] for key, entry in dict.items(self)}) def keys(self): """ Make sure keys() iterates on keys based on their priority. """ -- cgit v1.2.3