From: Daniele Varrazzo Date: Thu, 23 Apr 2020 04:28:32 +0000 (+1200) Subject: Fixed import of optimized Transformer X-Git-Tag: 3.0.dev0~544 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e52cb0e9c46e786593236db5f5592ed685a21a7a;p=thirdparty%2Fpsycopg.git Fixed import of optimized Transformer Import it if the C module is used, not just if it's available. --- 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