summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2023-04-02 23:54:34 -0400
committerGitHub <noreply@github.com>2023-04-03 05:54:34 +0200
commit465f3c045b2cb7d757a8cbabc909c137901c9844 (patch)
tree3427982d05e809d357a8d727dbfcffb16e03e592 /django
parent56dadad7435af75d57a29699855d82b37434259a (diff)
downloaddjango-465f3c045b2cb7d757a8cbabc909c137901c9844.tar.gz
Prevented PostgreSQL's DatabaseCreation._execute_create_test_db() from hiding clause-less exceptions.
Regression in 3cafb783f3f711c7413ba2b8d7c8ff750bd4d6e1.
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/postgresql/creation.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/django/db/backends/postgresql/creation.py b/django/db/backends/postgresql/creation.py
index b445b89646..9b562cec18 100644
--- a/django/db/backends/postgresql/creation.py
+++ b/django/db/backends/postgresql/creation.py
@@ -45,8 +45,7 @@ class DatabaseCreation(BaseDatabaseCreation):
return
super()._execute_create_test_db(cursor, parameters, keepdb)
except Exception as e:
- cause = e.__cause__
- if cause and not isinstance(cause, errors.DuplicateDatabase):
+ if not isinstance(e.__cause__, errors.DuplicateDatabase):
# All errors except "database already exists" cancel tests.
self.log("Got an error creating the test database: %s" % e)
sys.exit(2)