Opened 18 years ago

Closed 18 years ago

Last modified 18 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: no UI/UX: no

Description

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

Index: django/utils/itercompat.py
===================================================================
--- django/utils/itercompat.py  (revision 3852)
+++ django/utils/itercompat.py  (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 by Malcolm Tredinnick, 18 years ago

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

comment:2 by Malcolm Tredinnick, 18 years ago

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