From 99fc9b5f5f7bd283e8f931ec8d5ea3654c6c67e6 Mon Sep 17 00:00:00 2001 From: jason kirtland Date: Wed, 3 Jul 2013 09:40:46 +0200 Subject: Correct Python 3 regression in hash identity (fixes #8) --- blinker/_utilities.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/blinker/_utilities.py b/blinker/_utilities.py index 076f2e8..a0c26bb 100644 --- a/blinker/_utilities.py +++ b/blinker/_utilities.py @@ -104,10 +104,16 @@ class symbol(object): return cls.symbols.setdefault(name, _symbol(name)) +try: + text = (str, unicode) +except NameError: + text = str + + def hashable_identity(obj): if hasattr(obj, 'im_func'): return (id(obj.im_func), id(obj.im_self)) - elif isinstance(obj, basestring): + elif isinstance(obj, text): return obj else: return id(obj) -- cgit v1.2.1