[Python-checkins] cpython (2.7): allow any number to be returned from __length_hint__ (closes #15354)

benjamin.peterson python-checkins at python.org
Sun Jul 15 02:57:09 CEST 2012


http://hg.python.org/cpython/rev/872afada51b0
changeset:   78102:872afada51b0
branch:      2.7
parent:      78090:814927ff4ef2
user:        Benjamin Peterson <benjamin at python.org>
date:        Sat Jul 14 17:53:55 2012 -0700
summary:
  allow any number to be returned from __length_hint__ (closes #15354)

files:
  Objects/abstract.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Objects/abstract.c b/Objects/abstract.c
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -126,7 +126,7 @@
         PyErr_Clear();
         return defaultvalue;
     }
-    rv = PyLong_Check(ro) ? PyLong_AsSsize_t(ro) : defaultvalue;
+    rv = PyNumber_Check(ro) ? PyInt_AsSsize_t(ro) : defaultvalue;
     Py_DECREF(ro);
     return rv;
 }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list