From e52cb0e9c46e786593236db5f5592ed685a21a7a Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 23 Apr 2020 16:28:32 +1200 Subject: [PATCH] Fixed import of optimized Transformer Import it if the C module is used, not just if it's available. --- psycopg3/adapt.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/psycopg3/adapt.py b/psycopg3/adapt.py index bc316402e..33cd0af79 100644 --- a/psycopg3/adapt.py +++ b/psycopg3/adapt.py @@ -409,7 +409,6 @@ def _connection_from_context( raise TypeError(f"can't get a connection from {type(context)}") -try: +# Override it with fast object if available +if pq.__impl__ == "c": from ._psycopg3 import Transformer # noqa -except ImportError: - pass -- 2.47.2