8000 gh-108278: Deprecate passing the three first params as keyword args for sqlite3 UDF creation APIs by erlend-aasland · Pull Request #108281 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-108278: Deprecate passing the three first params as keyword args for sqlite3 UDF creation APIs #108281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
erlend-aasland committed Aug 23, 2023
commit 833197abe60f2cfdf61dad8dfb0216dee922072f
20 changes: 20 additions & 0 deletions Lib/test/test_sqlite3/test_userfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,26 @@ def test_func_return_illegal_value(self):
self.assertRaisesRegex(sqlite.OperationalError, msg,
self.con.execute, "select badreturn()")

def test_func_keyword_args(self):
regex = (
r"Passing keyword arguments 'name', 'narg' and 'func' to "
r"_sqlite3.Connection.create_function\(\) is deprecated. "
r"Parameters 'name', 'narg' and 'func' will become "
r"positional-only in Python 3.15."
)

def check(*args, **kwds):
with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
self.con.create_function(*args, **kwds)
self.assertEqual(cm.filename, __file__)

def noop():
return None

check("noop", 0, func=noop)
check("noop", narg=0, func=noop)
check(name="noop", narg=0, func=noop)


class WindowSumInt:
def __init__(self):
Expand Down
0