[Python-3000-checkins] r62280 - python/branches/py3k/Objects/abstract.c

trent.nelson python-3000-checkins at python.org
Fri Apr 11 00:21:24 CEST 2008


Author: trent.nelson
Date: Fri Apr 11 00:21:23 2008
New Revision: 62280

Modified:
   python/branches/py3k/Objects/abstract.c
Log:
Fix change to PyNumber_Index() made in r62269, which incorrectly allowed floats to be interpreted as longs.  Thanks to Benjamin Peterson for picking this up.

Modified: python/branches/py3k/Objects/abstract.c
==============================================================================
--- python/branches/py3k/Objects/abstract.c	(original)
+++ python/branches/py3k/Objects/abstract.c	Fri Apr 11 00:21:23 2008
@@ -1240,7 +1240,7 @@
 			return NULL;
 		}
 	}
-	else if (m && m->nb_int != NULL) {
+	else if (m && m->nb_int != NULL && m->nb_float == NULL) {
 		result = m->nb_int(item);
 		if (result && !PyLong_Check(result)) {
 			PyErr_Format(PyExc_TypeError,


More information about the Python-3000-checkins mailing list