From 7346c288e307e1821e3ceb757d686c9bd879389c Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 7 Jan 2022 16:29:15 +0100 Subject: [PATCH] Refs #32355 -- Removed unnecessary list() calls before reversed() on dictviews. Dict and dictviews are iterable in reversed insertion order using reversed() in Python 3.8+. --- django/core/management/__init__.py | 2 +- django/utils/translation/trans_real.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 049297b5aa..6133e71c50 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -68,7 +68,7 @@ def get_commands(): if not settings.configured: return commands - for app_config in reversed(list(apps.get_app_configs())): + for app_config in reversed(apps.get_app_configs()): path = os.path.join(app_config.path, 'management') commands.update({name: app_config.name for name in find_commands(path)}) diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 7a6bc81406..97efd40c6d 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -191,7 +191,7 @@ class DjangoTranslation(gettext_module.GNUTranslations): def _add_installed_apps_translations(self): """Merge translations from each installed app.""" try: - app_configs = reversed(list(apps.get_app_configs())) + app_configs = reversed(apps.get_app_configs()) except AppRegistryNotReady: raise AppRegistryNotReady( "The translation infrastructure cannot be initialized before the "