From 2fc1791e851e5f9b1f43b368a6ab39bce9f932d2 Mon Sep 17 00:00:00 2001 From: tvalentyn Date: Wed, 16 May 2018 14:00:29 -0700 Subject: [PATCH] Make hash function in Coder base class more conservative, to avoid evaluating hash based on potentially mutable collection. --- sdks/python/apache_beam/{coders/coders.py => cod} | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename sdks/python/apache_beam/{coders/coders.py => cod} (99%) diff --git a/sdks/python/apache_beam/coders/coders.py b/sdks/python/apache_beam/cod similarity index 99% rename from sdks/python/apache_beam/coders/coders.py rename to sdks/python/apache_beam/cod index b6aa40d6c82f..e9ba160c835b 100644 --- a/sdks/python/apache_beam/coders/coders.py +++ b/sdks/python/apache_beam/cod @@ -220,11 +220,10 @@ def __repr__(self): def __eq__(self, other): return (self.__class__ == other.__class__ and self._dict_without_impl() == other._dict_without_impl()) + # pylint: enable=protected-access def __hash__(self): - return hash((self.__class__,) + - tuple(sorted(self._dict_without_impl().items()))) - # pylint: enable=protected-access + return hash(type(self)) _known_urns = {}