| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 77e8f23 commit 0b0c1d0
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -763,10 +763,10 @@ Connection objects | |||
| 763 | 763 | ... print(row) | |
| 764 | 764 | ('acbd18db4cc2f85cedef654fccc4a4d8',) | |
| 765 | 765 | ||
| 766 | - .. versionchanged:: 3.13 | ||
| 766 | + .. versionchanged:: 3.13 | ||
| 767 | 767 | ||
| 768 | - Passing *name*, *narg*, and *func* as keyword arguments is deprecated. | ||
| 769 | - These parameters will become positional-only in Python 3.15. | ||
| 768 | + Passing *name*, *narg*, and *func* as keyword arguments is deprecated. | ||
| 769 | + These parameters will become positional-only in Python 3.15. | ||
| 770 | 770 | ||
| 771 | 771 | ||
| 772 | 772 | .. method:: create_aggregate(name, n_arg, aggregate_class) | |
@@ -822,10 +822,10 @@ Connection objects | |||
| 822 | 822 | ||
| 823 | 823 | 3 | |
| 824 | 824 | ||
| 825 | - .. versionchanged:: 3.13 | ||
| 825 | + .. versionchanged:: 3.13 | ||
| 826 | 826 | ||
| 827 | - Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is deprecated. | ||
| 828 | - These parameters will become positional-only in Python 3.15. | ||
| 827 | + Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is deprecated. | ||
| 828 | + These parameters will become positional-only in Python 3.15. | ||
| 829 | 829 | ||
| 830 | 830 | ||
| 831 | 831 | .. method:: create_window_function(name, num_params, aggregate_class, /) | |
@@ -991,6 +991,11 @@ Connection objects | |||
| 991 | 991 | .. versionchanged:: 3.11 | |
| 992 | 992 | Added support for disabling the authorizer using ``None``. | |
| 993 | 993 | ||
| 994 | + .. versionchanged:: 3.13 | ||
| 995 | + | ||
| 996 | + Passing *authorizer_callback* as a keyword argument to is deprecated. | ||
| 997 | + The parameter will become positional-only in Python 3.15. | ||
| 998 | + | ||
| 994 | 999 | ||
| 995 | 1000 | .. method:: set_progress_handler(progress_handler, n) | |
| 996 | 1001 | ||
@@ -1006,6 +1011,11 @@ Connection objects | |||
| 1006 | 1011 | currently executing query and cause it to raise a :exc:`DatabaseError` | |
| 1007 | 1012 | exception. | |
| 1008 | 1013 | ||
| 1014 | + .. versionchanged:: 3.13 | ||
| 1015 | + | ||
| 1016 | + Passing *progress_handler* as a keyword argument to is deprecated. | ||
| 1017 | + The parameter will become positional-only in Python 3.15. | ||
| 1018 | + | ||
| 1009 | 1019 | ||
| 1010 | 1020 | .. method:: set_trace_callback(trace_callback) | |
| 1011 | 1021 | ||
@@ -1030,6 +1040,11 @@ Connection objects | |||
| 1030 | 1040 | ||
| 1031 | 1041 | .. versionadded:: 3.3 | |
| 1032 | 1042 | ||
| 1043 | + .. versionchanged:: 3.13 | ||
| 1044 | + | ||
| 1045 | + Passing *trace_callback* as a keyword argument to is deprecated. | ||
| 1046 | + The parameter will become positional-only in Python 3.15. | ||
| 1047 | + | ||
| 1033 | 1048 | ||
| 1034 | 1049 | .. method:: enable_load_extension(enabled, /) | |
| 1035 | 1050 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -266,6 +266,13 @@ Deprecated | |||
| 266 | 266 | * :meth:`~sqlite3.Connection.create_function` | |
| 267 | 267 | * :meth:`~sqlite3.Connection.create_aggregate` | |
| 268 | 268 | ||
| 269 | + Deprecate passing the callback callable by keyword for the following | ||
| 270 | + :class:`sqlite3.Connection` APIs: | ||
| 271 | + | ||
| 272 | + * :meth:`~sqlite3.Connection.set_authorizer` | ||
| 273 | + * :meth:`~sqlite3.Connection.set_progress_handler` | ||
| 274 | + * :meth:`~sqlite3.Connection.set_trace_callback` | ||
| 275 | + | ||
| 269 | 276 | The affected parameters will become positional-only in Python 3.15. | |
| 270 | 277 | ||
| 271 | 278 | (Contributed by Erlend E. Aasland in :gh:`107948` and :gh:`108278`.) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -219,6 +219,18 @@ def bad_progress(): | |||
| 219 | 219 | create table foo(a, b) | |
| 220 | 220 | """) | |
| 221 | 221 | ||
| 222 | + def test_progress_handler_keyword_args(self): | ||
| 223 | + regex = ( | ||
| 224 | + r"Passing keyword argument 'progress_handler' to " | ||
| 225 | + r"_sqlite3.Connection.set_progress_handler\(\) is deprecated. " | ||
| 226 | + r"Parameter 'progress_handler' will become positional-only in " | ||
| 227 | + r"Python 3.15." | ||
| 228 | + ) | ||
| 229 | + | ||
| 230 | + with self.assertWarnsRegex(DeprecationWarning, regex) as cm: | ||
| 231 | + self.con.set_progress_handler(progress_handler=lambda: None, n=1) | ||
| 232 | + self.assertEqual(cm.filename, __file__) | ||
| 233 | + | ||
| 222 | 234 | ||
| 223 | 235 | class TraceCallbackTests(MemoryDatabaseMixin, unittest.TestCase): | |
| 224 | 236 | ||
@@ -340,6 +352,18 @@ def test_trace_bad_handler(self): | |||
| 340 | 352 | cx.set_trace_callback(lambda stmt: 5/0) | |
| 341 | 353 | cx.execute("select 1") | |
| 342 | 354 | ||
| 355 | + def test_trace_keyword_args(self): | ||
| 356 | + regex = ( | ||
| 357 | + r"Passing keyword argument 'trace_callback' to " | ||
| 358 | + r"_sqlite3.Connection.set_trace_callback\(\) is deprecated. " | ||
| 359 | + r"Parameter 'trace_callback' will become positional-only in " | ||
| 360 | + r"Python 3.15." | ||
| 361 | + ) | ||
| 362 | + | ||
| 363 | + with self.assertWarnsRegex(DeprecationWarning, regex) as cm: | ||
| 364 | + self.con.set_trace_callback(trace_callback=lambda: None) | ||
| 365 | + self.assertEqual(cm.filename, __file__) | ||
| 366 | + | ||
| 343 | 367 | ||
| 344 | 368 | if __name__ == "__main__": | |
| 345 | 369 | unittest.main() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -737,6 +737,27 @@ def test_aggr_text(self): | |||
| 737 | 737 | val = cur.fetchone()[0] | |
| 738 | 738 | self.assertEqual(val, txt) | |
| 739 | 739 | ||
| 740 | + def test_agg_keyword_args(self): | ||
| 741 | + regex = ( | ||
| 742 | + r"Passing keyword arguments 'name', 'n_arg' and 'aggregate_class' to " | ||
| 743 | + r"_sqlite3.Connection.create_aggregate\(\) is deprecated. " | ||
| 744 | + r"Parameters 'name', 'n_arg' and 'aggregate_class' will become " | ||
| 745 | + r"positional-only in Python 3.15." | ||
| 746 | + ) | ||
| 747 | + | ||
| 748 | + with self.assertWarnsRegex(DeprecationWarning, regex) as cm: | ||
| 749 | + self.con.create_aggregate("test", 1, aggregate_class=AggrText) | ||
| 750 | + self.assertEqual(cm.filename, __file__) | ||
| 751 | + | ||
| 752 | + with self.assertWarnsRegex(DeprecationWarning, regex) as cm: | ||
| 753 | + self.con.create_aggregate("test", n_arg=1, aggregate_class=AggrText) | ||
| 754 | + self.assertEqual(cm.filename, __file__) | ||
| 755 | + | ||
| 756 | + with self.assertWarnsRegex(DeprecationWarning, regex) as cm: | ||
| 757 | + self.con.create_aggregate(name="test", n_arg=0, | ||
| 758 | + aggregate_class=AggrText) | ||
| 759 | + self.assertEqual(cm.filename, __file__) | ||
| 760 | + | ||
| 740 | 761 | ||
| 741 | 762 | class AuthorizerTests(unittest.TestCase): | |
| 742 | 763 | @staticmethod | |
@@ -779,6 +800,18 @@ def test_clear_authorizer(self): | |||
| 779 | 800 | self.con.execute("select * from t2") | |
| 780 | 801 | self.con.execute("select c2 from t1") | |
| 781 | 802 | ||
| 803 | + def test_authorizer_keyword_args(self): | ||
| 804 | + regex = ( | ||
| 805 | + r"Passing keyword argument 'authorizer_callback' to " | ||
| 806 | + r"_sqlite3.Connection.set_authorizer\(\) is deprecated. " | ||
| 807 | + r"Parameter 'authorizer_callback' will become positional-only in " | ||
| 808 | + r"Python 3.15." | ||
| 809 | + ) | ||
| 810 | + | ||
| 811 | + with self.assertWarnsRegex(DeprecationWarning, regex) as cm: | ||
| 812 | + self.con.set_authorizer(authorizer_callback=lambda: None) | ||
| 813 | + self.assertEqual(cm.filename, __file__) | ||
| 814 | + | ||
| 782 | 815 | ||
| 783 | 816 | class AuthorizerRaiseExceptionTests(AuthorizerTests): | |
| 784 | 817 | @staticmethod | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + Deprecate passing the callback callable by keyword for the following | ||
| 2 | + :class:`sqlite3.Connection` APIs: | ||
| 3 | + | ||
| 4 | + * :meth:`~sqlite3.Connection.set_authorizer` | ||
| 5 | + * :meth:`~sqlite3.Connection.set_progress_handler` | ||
| 6 | + * :meth:`~sqlite3.Connection.set_trace_callback` | ||
| 7 | + | ||
| 8 | + The affected parameters will become positional-only in Python 3.15. | ||
| 9 | + | ||
| 10 | + Patch by Erlend E. Aasland. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments