M django/core/paginator.py => django/core/paginator.py +1 -1
@@ 103,7 103,7 @@ class Paginator(object):
QuerySetPaginator = Paginator # For backwards-compatibility.
-class Page(collections.Sequence):
+class Page(collections.abc.Sequence):
def __init__(self, object_list, number, paginator):
self.object_list = object_list
M django/db/models/fields/__init__.py => django/db/models/fields/__init__.py +2 -2
@@ 157,7 157,7 @@ class Field(RegisterLookupMixin):
self.unique_for_date = unique_for_date
self.unique_for_month = unique_for_month
self.unique_for_year = unique_for_year
- if isinstance(choices, collections.Iterator):
+ if isinstance(choices, collections.abc.Iterator):
choices = list(choices)
self.choices = choices or []
self.help_text = help_text
@@ 428,7 428,7 @@ class Field(RegisterLookupMixin):
for name, default in possibles.items():
value = getattr(self, attr_overrides.get(name, name))
# Unroll anything iterable for choices into a concrete list
- if name == "choices" and isinstance(value, collections.Iterable):
+ if name == "choices" and isinstance(value, collections.abc.Iterable):
value = list(value)
# Do correct kind of comparison
if name in equals_comparison:
M django/db/models/sql/query.py => django/db/models/sql/query.py +2 -1
@@ 8,7 8,8 @@ all about the internals of models in order to get the information it needs.
"""
import copy
import warnings
-from collections import Counter, Iterator, Mapping, OrderedDict
+from collections import Counter, OrderedDict
+from collections.abc import Iterator, Mapping
from itertools import chain, count, product
from string import ascii_uppercase
M tests/lookup/tests.py => tests/lookup/tests.py +1 -1
@@ 76,7 76,7 @@ class LookupTests(TestCase):
def test_iterator(self):
# Each QuerySet gets iterator(), which is a generator that "lazily"
# returns results using database-level iteration.
- self.assertIsInstance(Article.objects.iterator(), collections.Iterator)
+ self.assertIsInstance(Article.objects.iterator(), collections.abc.Iterator)
self.assertQuerysetEqual(Article.objects.iterator(),
[