Explorar el Código

utils.debug: Fixes memsample IndexError bug

Ask Solem hace 12 años
padre
commit
894023a414
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      celery/utils/debug.py

+ 4 - 1
celery/utils/debug.py

@@ -117,7 +117,10 @@ def sample(x, n, k=0):
     """
     j = len(x) // n
     for _ in range(n):
-        yield x[k]
+        try:
+            yield x[k]
+        except IndexError:
+            break
         k += j