From 82ca39b32fddd2b6168b4eff3262ef41e65a44c3 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Fri, 15 Nov 2013 05:00:44 +0000 Subject: [PATCH] Stop hash() from working in Python 2, to match Python 3 behaviour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids DeprecationWarning warnings when running with “python2 -3”. --- sh.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sh.py b/sh.py index 5bf2e68a..a6c15012 100644 --- a/sh.py +++ b/sh.py @@ -416,6 +416,7 @@ def __unicode__(self): def __eq__(self, other): return unicode(self) == unicode(other) + __hash__ = None # Avoid DeprecationWarning in Python < 3 def __contains__(self, item): return item in str(self) @@ -675,6 +676,7 @@ def __str__(self): def __eq__(self, other): try: return str(self) == str(other) except: return False + __hash__ = None # Avoid DeprecationWarning in Python < 3 def __repr__(self):