Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#2823 closed defect (fixed)

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

Reported by: Alex Dedul Owned by: adrian
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:

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 Changed 9 years ago by mtredinnick

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

comment:2 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(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