From: Mike Bayer Date: Wed, 31 Mar 2021 13:53:35 +0000 (-0400) Subject: Repair pg8000 disconnect patch X-Git-Tag: rel_1_4_5~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d11356f444ece3310fb13cd83b4c6df913aca078;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Repair pg8000 disconnect patch For unknown reasons a space character got into the error message being tested in #6099. The fix is entirely non working in 1.4.4. Fixes: #6099 Change-Id: Ib2929be59d62eb2446fc8f040293c9228df7a531 --- diff --git a/doc/build/changelog/unreleased_14/6099.rst b/doc/build/changelog/unreleased_14/6099.rst new file mode 100644 index 0000000000..6a5a299e59 --- /dev/null +++ b/doc/build/changelog/unreleased_14/6099.rst @@ -0,0 +1,7 @@ +.. change:: + :tags: bug, postgresql + :tickets: 6099 + + Fixed typo in the fix for :ticket:`6099` released in 1.4.4 that completely + prevented it from working correctly, i.e. the error message did not match + what was actually emitted by pg8000. diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index cda0bc9415..43df6edea2 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -328,9 +328,9 @@ class PGDialect_pg8000(PGDialect): return ([], opts) def is_disconnect(self, e, connection, cursor): - if isinstance( - e, self.dbapi.InterfaceError - ) and "network error" in str(e): + if isinstance(e, self.dbapi.InterfaceError) and "network error" in str( + e + ): # new as of pg8000 1.19.0 for broken connections return True