diff options
| author | Tim Graham <timograham@gmail.com> | 2017-09-07 08:16:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-07 08:16:21 -0400 |
| commit | 6e4c6281dbb7ee12bcdc22620894edb4e9cf623f (patch) | |
| tree | 1c21218d4b6f00c499f18943d5190ebe7b5248c9 /django/core/management/base.py | |
| parent | 8b2515a450ef376b9205029090af0a79c8341bd7 (diff) | |
Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda
because try/except performs better.
Diffstat (limited to 'django/core/management/base.py')
| -rw-r--r-- | django/core/management/base.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/django/core/management/base.py b/django/core/management/base.py index b53b414fdb..41b6b0fa91 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -5,7 +5,6 @@ be executed through ``django-admin`` or ``manage.py``). import os import sys from argparse import ArgumentParser -from contextlib import suppress from io import TextIOBase import django @@ -298,10 +297,12 @@ class BaseCommand: self.stderr.write('%s: %s' % (e.__class__.__name__, e)) sys.exit(1) finally: - # Ignore if connections aren't setup at this point (e.g. no - # configured settings). - with suppress(ImproperlyConfigured): + try: connections.close_all() + except ImproperlyConfigured: + # Ignore if connections aren't setup at this point (e.g. no + # configured settings). + pass def execute(self, *args, **options): """ |
