diff --git a/django/utils/itercompat.py b/django/utils/itercompat.py deleted file mode 100644 index e4b34cd534..0000000000 --- a/django/utils/itercompat.py +++ /dev/null @@ -1,21 +0,0 @@ -# RemovedInDjango60Warning: Remove this entire module. - -import warnings - -from django.utils.deprecation import RemovedInDjango60Warning - - -def is_iterable(x): - "An implementation independent way of checking for iterables" - warnings.warn( - "django.utils.itercompat.is_iterable() is deprecated. " - "Use isinstance(..., collections.abc.Iterable) instead.", - RemovedInDjango60Warning, - stacklevel=2, - ) - try: - iter(x) - except TypeError: - return False - else: - return True diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt index e3f6c8afed..5871f09e7b 100644 --- a/docs/releases/6.0.txt +++ b/docs/releases/6.0.txt @@ -302,3 +302,6 @@ to remove usage of these features. * The ``ModelAdmin.log_deletion()`` and ``LogEntryManager.log_action()`` methods are removed. + +* The undocumented ``django.utils.itercompat.is_iterable()`` function and the + ``django.utils.itercompat`` module is removed. diff --git a/tests/utils_tests/test_itercompat.py b/tests/utils_tests/test_itercompat.py deleted file mode 100644 index a95867c621..0000000000 --- a/tests/utils_tests/test_itercompat.py +++ /dev/null @@ -1,16 +0,0 @@ -# RemovedInDjango60Warning: Remove this entire module. - -from django.test import SimpleTestCase -from django.utils.deprecation import RemovedInDjango60Warning -from django.utils.itercompat import is_iterable - - -class TestIterCompat(SimpleTestCase): - def test_is_iterable_deprecation(self): - msg = ( - "django.utils.itercompat.is_iterable() is deprecated. " - "Use isinstance(..., collections.abc.Iterable) instead." - ) - with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx: - is_iterable([]) - self.assertEqual(ctx.filename, __file__)