[Python-checkins] r86619 - python/branches/py3k/Objects/rangeobject.c

georg.brandl python-checkins at python.org
Sat Nov 20 23:40:10 CET 2010


Author: georg.brandl
Date: Sat Nov 20 23:40:10 2010
New Revision: 86619

Log:
Add error handling in range_count.

Modified:
   python/branches/py3k/Objects/rangeobject.c

Modified: python/branches/py3k/Objects/rangeobject.c
==============================================================================
--- python/branches/py3k/Objects/rangeobject.c	(original)
+++ python/branches/py3k/Objects/rangeobject.c	Sat Nov 20 23:40:10 2010
@@ -337,7 +337,10 @@
 range_count(rangeobject *r, PyObject *ob)
 {
     if (PyLong_CheckExact(ob) || PyBool_Check(ob)) {
-        if (range_contains_long(r, ob))
+        int result = range_contains_long(r, ob);
+        if (result == -1)
+            return NULL;
+        else if (result)
             return PyLong_FromLong(1);
         else
             return PyLong_FromLong(0);


More information about the Python-checkins mailing list