[Python-3000-checkins] r65808 - in python/branches/py3k: Lib/numbers.py Misc/NEWS

nick.coghlan python-3000-checkins at python.org
Mon Aug 18 14:31:53 CEST 2008


Author: nick.coghlan
Date: Mon Aug 18 14:31:52 2008
New Revision: 65808

Log:
Forward port only Py3k relevant change in r65642 (giving it a Py3k NEWS entry anyway because of the difference in the changes between the two branches)

Modified:
   python/branches/py3k/Lib/numbers.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/numbers.py
==============================================================================
--- python/branches/py3k/Lib/numbers.py	(original)
+++ python/branches/py3k/Lib/numbers.py	Mon Aug 18 14:31:52 2008
@@ -15,6 +15,8 @@
     If you just want to check if an argument x is a number, without
     caring what kind, use isinstance(x, Number).
     """
+    # Concrete numeric types must provide their own hash implementation
+    __hash__ = None
 
 
 ## Notes on Decimal

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Mon Aug 18 14:31:52 2008
@@ -30,6 +30,12 @@
 Library
 -------
 
+- Issue #2235: numbers.Number now blocks inheritance of the default id()
+  based hash because that hash mechanism is not correct for numeric types.
+  All concrete numeric types that inherit from Number (rather than just
+  registering with it) must explicitly provide a hash implementation in
+  order for their instances to be hashable.
+
 - Issue #2676: in the email package, content-type parsing was hanging on
   pathological input because of quadratic or exponential behaviour of a
   regular expression.


More information about the Python-3000-checkins mailing list