From: Daniele Varrazzo Date: Sun, 25 Jul 2021 19:24:02 +0000 (+0200) Subject: Make sure the conn.autocommit attribute is set to a bool X-Git-Tag: 3.0.dev2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f59aeb949f406e08a8c1787fe00ac5a3f1790653;p=thirdparty%2Fpsycopg.git Make sure the conn.autocommit attribute is set to a bool --- diff --git a/psycopg/psycopg/connection.py b/psycopg/psycopg/connection.py index f8e6fba26..ee1d280d5 100644 --- a/psycopg/psycopg/connection.py +++ b/psycopg/psycopg/connection.py @@ -187,7 +187,7 @@ class BaseConnection(Generic[Row]): # Base implementation, not thread safe. # Subclasses must call it holding a lock self._check_intrans("autocommit") - self._autocommit = value + self._autocommit = bool(value) @property def isolation_level(self) -> Optional[IsolationLevel]: @@ -428,7 +428,7 @@ class BaseConnection(Generic[Row]): if not row_factory: row_factory = tuple_row conn = cls(pgconn, row_factory) - conn._autocommit = autocommit + conn._autocommit = bool(autocommit) return conn def _exec_command(self, command: Query) -> PQGen["PGresult"]: