Skip to content

Commit 3aae31d

Browse files
committed
Add psycopg3 support
Fixes #130
1 parent d4fdb8d commit 3aae31d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bitfield/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,6 @@ def get_label(self, flag):
260260
from django.db.backends.postgresql.base import Database
261261
Database.extensions.register_adapter(Bit, lambda x: Database.extensions.AsIs(int(x)))
262262
Database.extensions.register_adapter(BitHandler, lambda x: Database.extensions.AsIs(int(x)))
263-
except ImproperlyConfigured:
263+
# Ignore in psycopg3 where there is no Database.extensions nor any need to adapt types
264+
except (ImproperlyConfigured, AttributeError):
264265
pass

0 commit comments

Comments
 (0)