#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 , 19 years ago
comment:2 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Oh, bother. Forgot to test with Python 2.3, so I didn't see this. Thanks. Will fix.