| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2561e14 commit dcf93c4
17 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -259,10 +259,10 @@ Reference | |||
| 259 | 259 | Module functions | |
| 260 | 260 | ^^^^^^^^^^^^^^^^ | |
| 261 | 261 | ||
| 262 | - .. function:: connect(database, timeout=5.0, detect_types=0, \ | ||
| 262 | + .. function:: connect(database, *, timeout=5.0, detect_types=0, \ | ||
| 263 | 263 | isolation_level="DEFERRED", check_same_thread=True, \ | |
| 264 | 264 | factory=sqlite3.Connection, cached_statements=128, \ | |
| 265 | - uri=False, *, \ | ||
| 265 | + uri=False, \ | ||
| 266 | 266 | autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL) | |
| 267 | 267 | ||
| 268 | 268 | Open a connection to an SQLite database. | |
@@ -355,11 +355,8 @@ Module functions | |||
| 355 | 355 | .. versionchanged:: 3.12 | |
| 356 | 356 | Added the *autocommit* parameter. | |
| 357 | 357 | ||
| 358 | - .. versionchanged:: 3.13 | ||
| 359 | - Positional use of the parameters *timeout*, *detect_types*, | ||
| 360 | - *isolation_level*, *check_same_thread*, *factory*, *cached_statements*, | ||
| 361 | - and *uri* is deprecated. | ||
| 362 | - They will become keyword-only parameters in Python 3.15. | ||
| 358 | + .. versionchanged:: 3.15 | ||
| 359 | + All parameters except *database* are now keyword-only. | ||
| 363 | 360 | ||
| 364 | 361 | .. function:: complete_statement(statement) | |
| 365 | 362 | ||
@@ -693,7 +690,7 @@ Connection objects | |||
| 693 | 690 | :meth:`~Cursor.executescript` on it with the given *sql_script*. | |
| 694 | 691 | Return the new cursor object. | |
| 695 | 692 | ||
| 696 | - .. method:: create_function(name, narg, func, *, deterministic=False) | ||
| 693 | + .. method:: create_function(name, narg, func, /, *, deterministic=False) | ||
| 697 | 694 | ||
| 698 | 695 | Create or remove a user-defined SQL function. | |
| 699 | 696 | ||
@@ -719,6 +716,9 @@ Connection objects | |||
| 719 | 716 | .. versionchanged:: 3.8 | |
| 720 | 717 | Added the *deterministic* parameter. | |
| 721 | 718 | ||
| 719 | + .. versionchanged:: 3.15 | ||
| 720 | + The first three parameters are now positional-only. | ||
| 721 | + | ||
| 722 | 722 | Example: | |
| 723 | 723 | ||
| 724 | 724 | .. doctest:: | |
@@ -733,13 +733,8 @@ Connection objects | |||
| 733 | 733 | ('acbd18db4cc2f85cedef654fccc4a4d8',) | |
| 734 | 734 | >>> con.close() | |
| 735 | 735 | ||
| 736 | - .. versionchanged:: 3.13 | ||
| 737 | - | ||
| 738 | - Passing *name*, *narg*, and *func* as keyword arguments is deprecated. | ||
| 739 | - These parameters will become positional-only in Python 3.15. | ||
| 740 | - | ||
| 741 | 736 | ||
| 742 | - .. method:: create_aggregate(name, n_arg, aggregate_class) | ||
| 737 | + .. method:: create_aggregate(name, n_arg, aggregate_class, /) | ||
| 743 | 738 | ||
| 744 | 739 | Create or remove a user-defined SQL aggregate function. | |
| 745 | 740 | ||
@@ -763,6 +758,9 @@ Connection objects | |||
| 763 | 758 | Set to ``None`` to remove an existing SQL aggregate function. | |
| 764 | 759 | :type aggregate_class: :term:`class` | None | |
| 765 | 760 | ||
| 761 | + .. versionchanged:: 3.15 | ||
| 762 | + All three parameters are now positional-only. | ||
| 763 | + | ||
| 766 | 764 | Example: | |
| 767 | 765 | ||
| 768 | 766 | .. testcode:: | |
@@ -792,11 +790,6 @@ Connection objects | |||
| 792 | 790 | ||
| 793 | 791 | 3 | |
| 794 | 792 | ||
| 795 | - .. versionchanged:: 3.13 | ||
| 796 | - | ||
| 797 | - Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is deprecated. | ||
| 798 | - These parameters will become positional-only in Python 3.15. | ||
| 799 | - | ||
| 800 | 793 | ||
| 801 | 794 | .. method:: create_window_function(name, num_params, aggregate_class, /) | |
| 802 | 795 | ||
@@ -937,7 +930,7 @@ Connection objects | |||
| 937 | 930 | Aborted queries will raise an :exc:`OperationalError`. | |
| 938 | 931 | ||
| 939 | 932 | ||
| 940 | - .. method:: set_authorizer(authorizer_callback) | ||
| 933 | + .. method:: set_authorizer(authorizer_callback, /) | ||
| 941 | 934 | ||
| 942 | 935 | Register :term:`callable` *authorizer_callback* to be invoked | |
| 943 | 936 | for each attempt to access a column of a table in the database. | |
@@ -962,12 +955,11 @@ Connection objects | |||
| 962 | 955 | .. versionchanged:: 3.11 | |
| 963 | 956 | Added support for disabling the authorizer using ``None``. | |
| 964 | 957 | ||
| 965 | - .. versionchanged:: 3.13 | ||
| 966 | - Passing *authorizer_callback* as a keyword argument is deprecated. | ||
| 967 | - The parameter will become positional-only in Python 3.15. | ||
| 958 | + .. versionchanged:: 3.15 | ||
| 959 | + The only parameter is now positional-only. | ||
| 968 | 960 | ||
| 969 | 961 | ||
| 970 | - .. method:: set_progress_handler(progress_handler, n) | ||
| 962 | + .. method:: set_progress_handler(progress_handler, /, n) | ||
| 971 | 963 | ||
| 972 | 964 | Register :term:`callable` *progress_handler* to be invoked for every *n* | |
| 973 | 965 | instructions of the SQLite virtual machine. This is useful if you want to | |
@@ -981,12 +973,11 @@ Connection objects | |||
| 981 | 973 | currently executing query and cause it to raise a :exc:`DatabaseError` | |
| 982 | 974 | exception. | |
| 983 | 975 | ||
| 984 | - .. versionchanged:: 3.13 | ||
| 985 | - Passing *progress_handler* as a keyword argument is deprecated. | ||
| 986 | - The parameter will become positional-only in Python 3.15. | ||
| 976 | + .. versionchanged:: 3.15 | ||
| 977 | + The first parameter is now positional-only. | ||
| 987 | 978 | ||
| 988 | 979 | ||
| 989 | - .. method:: set_trace_callback(trace_callback) | ||
| 980 | + .. method:: set_trace_callback(trace_callback, /) | ||
| 990 | 981 | ||
| 991 | 982 | Register :term:`callable` *trace_callback* to be invoked | |
| 992 | 983 | for each SQL statement that is actually executed by the SQLite backend. | |
@@ -1009,9 +1000,8 @@ Connection objects | |||
| 1009 | 1000 | ||
| 1010 | 1001 | .. versionadded:: 3.3 | |
| 1011 | 1002 | ||
| 1012 | - .. versionchanged:: 3.13 | ||
| 1013 | - Passing *trace_callback* as a keyword argument is deprecated. | ||
| 1014 | - The parameter will become positional-only in Python 3.15. | ||
| 1003 | + .. versionchanged:: 3.15 | ||
| 1004 | + The first parameter is now positional-only. | ||
| 1015 | 1005 | ||
| 1016 | 1006 | ||
| 1017 | 1007 | .. method:: enable_load_extension(enabled, /) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -143,7 +143,16 @@ New features | |||
| 143 | 143 | Porting to Python 3.15 | |
| 144 | 144 | ---------------------- | |
| 145 | 145 | ||
| 146 | - * TODO | ||
| 146 | + * :class:`sqlite3.Connection` APIs has been cleaned up. | ||
| 147 | + | ||
| 148 | + * All parameters of :func:`sqlite3.connect` except *database* are now keyword-only. | ||
| 149 | + * The first three parameters of methods :meth:`~sqlite3.Connection.create_function` | ||
| 150 | + and :meth:`~sqlite3.Connection.create_aggregate` are now positional-only. | ||
| 151 | + * The first parameter of methods :meth:`~sqlite3.Connection.set_authorizer`, | ||
| 152 | + :meth:`~sqlite3.Connection.set_progress_handler` and | ||
| 153 | + :meth:`~sqlite3.Connection.set_trace_callback` is now positional-only. | ||
| 154 | + | ||
| 155 | + (Contributed by Serhiy Storchaka in :gh:`133595`.) | ||
| 147 | 156 | ||
| 148 | 157 | Deprecated C APIs | |
| 149 | 158 | ----------------- | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -283,7 +283,6 @@ struct _Py_global_strings { | |||
| 283 | 283 | STRUCT_FOR_ID(add_done_callback) | |
| 284 | 284 | STRUCT_FOR_ID(after_in_child) | |
| 285 | 285 | STRUCT_FOR_ID(after_in_parent) | |
| 286 | - STRUCT_FOR_ID(aggregate_class) | ||
| 287 | 286 | STRUCT_FOR_ID(alias) | |
| 288 | 287 | STRUCT_FOR_ID(align) | |
| 289 | 288 | STRUCT_FOR_ID(all) | |
@@ -300,7 +299,6 @@ struct _Py_global_strings { | |||
| 300 | 299 | STRUCT_FOR_ID(ast) | |
| 301 | 300 | STRUCT_FOR_ID(athrow) | |
| 302 | 301 | STRUCT_FOR_ID(attribute) | |
| 303 | - STRUCT_FOR_ID(authorizer_callback) | ||
| 304 | 302 | STRUCT_FOR_ID(autocommit) | |
| 305 | 303 | STRUCT_FOR_ID(backtick) | |
| 306 | 304 | STRUCT_FOR_ID(base) | |
@@ -599,15 +597,13 @@ struct _Py_global_strings { | |||
| 599 | 597 | STRUCT_FOR_ID(msg) | |
| 600 | 598 | STRUCT_FOR_ID(mutex) | |
| 601 | 599 | STRUCT_FOR_ID(mycmp) | |
| 602 | - STRUCT_FOR_ID(n_arg) | ||
| 603 | 600 | STRUCT_FOR_ID(n_fields) | |
| 604 | 601 | STRUCT_FOR_ID(n_sequence_fields) | |
| 605 | 602 | STRUCT_FOR_ID(n_unnamed_fields) | |
| 606 | 603 | STRUCT_FOR_ID(name) | |
| 607 | 604 | STRUCT_FOR_ID(name_from) | |
| 608 | 605 | STRUCT_FOR_ID(namespace_separator) | |
| 609 | 606 | STRUCT_FOR_ID(namespaces) | |
| 610 | - STRUCT_FOR_ID(narg) | ||
| 611 | 607 | STRUCT_FOR_ID(ndigits) | |
| 612 | 608 | STRUCT_FOR_ID(nested) | |
| 613 | 609 | STRUCT_FOR_ID(new_file_name) | |
@@ -665,7 +661,6 @@ struct _Py_global_strings { | |||
| 665 | 661 | STRUCT_FOR_ID(print_file_and_line) | |
| 666 | 662 | STRUCT_FOR_ID(priority) | |
| 667 | 663 | STRUCT_FOR_ID(progress) | |
| 668 | - STRUCT_FOR_ID(progress_handler) | ||
| 669 | 664 | STRUCT_FOR_ID(progress_routine) | |
| 670 | 665 | STRUCT_FOR_ID(proto) | |
| 671 | 666 | STRUCT_FOR_ID(protocol) | |
@@ -771,7 +766,6 @@ struct _Py_global_strings { | |||
| 771 | 766 | STRUCT_FOR_ID(timetuple) | |
| 772 | 767 | STRUCT_FOR_ID(timeunit) | |
| 773 | 768 | STRUCT_FOR_ID(top) | |
| 774 | - STRUCT_FOR_ID(trace_callback) | ||
| 775 | 769 | STRUCT_FOR_ID(traceback) | |
| 776 | 770 | STRUCT_FOR_ID(trailers) | |
| 777 | 771 | STRUCT_FOR_ID(translate) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -550,17 +550,9 @@ def test_connection_config(self): | |||
| 550 | 550 | cx.execute("insert into u values(0)") | |
| 551 | 551 | ||
| 552 | 552 | def test_connect_positional_arguments(self): | |
| 553 | - regex = ( | ||
| 554 | - r"Passing more than 1 positional argument to sqlite3.connect\(\)" | ||
| 555 | - " is deprecated. Parameters 'timeout', 'detect_types', " | ||
| 556 | - "'isolation_level', 'check_same_thread', 'factory', " | ||
| 557 | - "'cached_statements' and 'uri' will become keyword-only " | ||
| 558 | - "parameters in Python 3.15." | ||
| 559 | - ) | ||
| 560 | - with self.assertWarnsRegex(DeprecationWarning, regex) as cm: | ||
| 561 | - cx = sqlite.connect(":memory:", 1.0) | ||
| 562 | - cx.close() | ||
| 563 | - self.assertEqual(cm.filename, __file__) | ||
| 553 | + with self.assertRaisesRegex(TypeError, | ||
| 554 | + r'connect\(\) takes at most 1 positional arguments'): | ||
| 555 | + sqlite.connect(":memory:", 1.0) | ||
| 564 | 556 | ||
| 565 | 557 | def test_connection_resource_warning(self): | |
| 566 | 558 | with self.assertWarns(ResourceWarning): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments