summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Vo <auscompgeek@users.noreply.github.com>2020-03-28 00:20:00 +1100
committerGitHub <noreply@github.com>2020-03-27 13:20:00 +0000
commitfbf0782c63bd2aba3c504dabd04abdf10d269a22 (patch)
treee6e684736439cd27536856ed2de1b7ff8d4066d4
parentMerge pull request #7151 from matrix-org/jaywink/saml-redirect-fix (diff)
downloadsynapse-fbf0782c63bd2aba3c504dabd04abdf10d269a22.tar.xz
Only import sqlite3 when type checking (#7155)
Fixes: #7127
Signed-off-by: David Vo <david@vovo.id.au>
-rw-r--r--changelog.d/7155.bugfix1
-rw-r--r--synapse/storage/engines/sqlite.py7
2 files changed, 6 insertions, 2 deletions
diff --git a/changelog.d/7155.bugfix b/changelog.d/7155.bugfix
new file mode 100644

index 0000000000..0bf51e7aba --- /dev/null +++ b/changelog.d/7155.bugfix
@@ -0,0 +1 @@ +Avoid importing `sqlite3` when using the postgres backend. Contributed by David Vo. diff --git a/synapse/storage/engines/sqlite.py b/synapse/storage/engines/sqlite.py
index 2bfeefd54e..3bc2e8b986 100644 --- a/synapse/storage/engines/sqlite.py +++ b/synapse/storage/engines/sqlite.py
@@ -12,14 +12,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import sqlite3 import struct import threading +import typing from synapse.storage.engines import BaseDatabaseEngine +if typing.TYPE_CHECKING: + import sqlite3 # noqa: F401 -class Sqlite3Engine(BaseDatabaseEngine[sqlite3.Connection]): + +class Sqlite3Engine(BaseDatabaseEngine["sqlite3.Connection"]): def __init__(self, database_module, database_config): super().__init__(database_module, database_config)