Fix for register() on Python 3.7, refs #425

This commit is contained in:
Simon Willison 2022-04-13 15:35:57 -07:00
commit 4433eafff7

View file

@ -400,7 +400,8 @@ class Database:
name, arity, fn, **dict(kwargs, deterministic=True)
)
registered = True
except sqlite3.NotSupportedError:
except (sqlite3.NotSupportedError, TypeError):
# TypeError is Python 3.7 "function takes at most 3 arguments"
pass
if not registered:
self.conn.create_function(name, arity, fn, **kwargs)