Bug #1163325:  "special" decimals aren't hashable
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 7f71b83..fb11e8f 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -728,6 +728,10 @@
         # Decimal integers must hash the same as the ints
         # Non-integer decimals are normalized and hashed as strings
         # Normalization assures that hast(100E-1) == hash(10)
+        if self._is_special:
+            if self._isnan():
+                raise TypeError('Cannot hash a NaN value.')
+            return hash(str(self))
         i = int(self)
         if self == Decimal(i):
             return hash(i)