Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2823 closed defect (fixed)

[patch] Correctly call itertools.count() in django.utils.itercompat

Reported by: Alex Dedul Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Now it tries to call count() without importing it, patch is trivial

Index: django/utils/
--- django/utils/  (revision 3852)
+++ django/utils/  (working copy)
@@ -15,7 +15,7 @@
     # deliberate and safe in this instance.
     def gen(next, data={}, cnt=[0]):
         dpop = data.pop
-        for i in count():
+        for i in itertools.count():
             if i == cnt[0]:
                 item = data[i] = next()
                 cnt[0] += 1

Change History (2)

comment:1 Changed 12 years ago by Malcolm Tredinnick

Oh, bother. Forgot to test with Python 2.3, so I didn't see this. Thanks. Will fix.

comment:2 Changed 12 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [3853]) Fixed #2823 -- Fixed Python 2.3 compatibility problem pointed out by Alex Dedul.

Note: See TracTickets for help on using tickets.
Back to Top