Skip to content

Commit 2a6ee86

Browse files
authored
Merge branch 'main' into issue-133403
2 parents 00f7e1d + 26839ea commit 2a6ee86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+446
-593
lines changed

Doc/library/concurrent.futures.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
.. versionadded:: 3.2
88

9-
**Source code:** :source:`Lib/concurrent/futures/thread.py`
10-
and :source:`Lib/concurrent/futures/process.py`
9+
**Source code:** :source:`Lib/concurrent/futures/thread.py`,
10+
:source:`Lib/concurrent/futures/process.py`,
11+
and :source:`Lib/concurrent/futures/interpreter.py`
1112

1213
--------------
1314

Doc/library/functools.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,7 @@ The :mod:`functools` module defines the following functions:
403403
>>> remove_first_dear(message)
404404
'Hello, dear world!'
405405

406-
:data:`!Placeholder` has no special treatment when used in a keyword
407-
argument to :func:`!partial`.
406+
:data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword argument.
408407

409408
.. versionchanged:: 3.14
410409
Added support for :data:`Placeholder` in positional arguments.

Doc/library/sqlite3.rst

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ Reference
259259
Module functions
260260
^^^^^^^^^^^^^^^^
261261

262-
.. function:: connect(database, timeout=5.0, detect_types=0, \
262+
.. function:: connect(database, *, timeout=5.0, detect_types=0, \
263263
isolation_level="DEFERRED", check_same_thread=True, \
264264
factory=sqlite3.Connection, cached_statements=128, \
265-
uri=False, *, \
265+
uri=False, \
266266
autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL)
267267

268268
Open a connection to an SQLite database.
@@ -355,11 +355,8 @@ Module functions
355355
.. versionchanged:: 3.12
356356
Added the *autocommit* parameter.
357357

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.
363360

364361
.. function:: complete_statement(statement)
365362

@@ -693,7 +690,7 @@ Connection objects
693690
:meth:`~Cursor.executescript` on it with the given *sql_script*.
694691
Return the new cursor object.
695692

696-
.. method:: create_function(name, narg, func, *, deterministic=False)
693+
.. method:: create_function(name, narg, func, /, *, deterministic=False)
697694

698695
Create or remove a user-defined SQL function.
699696

@@ -719,6 +716,9 @@ Connection objects
719716
.. versionchanged:: 3.8
720717
Added the *deterministic* parameter.
721718

719+
.. versionchanged:: 3.15
720+
The first three parameters are now positional-only.
721+
722722
Example:
723723

724724
.. doctest::
@@ -733,13 +733,8 @@ Connection objects
733733
('acbd18db4cc2f85cedef654fccc4a4d8',)
734734
>>> con.close()
735735

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-
741736

742-
.. method:: create_aggregate(name, n_arg, aggregate_class)
737+
.. method:: create_aggregate(name, n_arg, aggregate_class, /)
743738

744739
Create or remove a user-defined SQL aggregate function.
745740

@@ -763,6 +758,9 @@ Connection objects
763758
Set to ``None`` to remove an existing SQL aggregate function.
764759
:type aggregate_class: :term:`class` | None
765760

761+
.. versionchanged:: 3.15
762+
All three parameters are now positional-only.
763+
766764
Example:
767765

768766
.. testcode::
@@ -792,11 +790,6 @@ Connection objects
792790

793791
3
794792

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-
800793

801794
.. method:: create_window_function(name, num_params, aggregate_class, /)
802795

@@ -937,7 +930,7 @@ Connection objects
937930
Aborted queries will raise an :exc:`OperationalError`.
938931

939932

940-
.. method:: set_authorizer(authorizer_callback)
933+
.. method:: set_authorizer(authorizer_callback, /)
941934

942935
Register :term:`callable` *authorizer_callback* to be invoked
943936
for each attempt to access a column of a table in the database.
@@ -962,12 +955,11 @@ Connection objects
962955
.. versionchanged:: 3.11
963956
Added support for disabling the authorizer using ``None``.
964957

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.
968960

969961

970-
.. method:: set_progress_handler(progress_handler, n)
962+
.. method:: set_progress_handler(progress_handler, /, n)
971963

972964
Register :term:`callable` *progress_handler* to be invoked for every *n*
973965
instructions of the SQLite virtual machine. This is useful if you want to
@@ -981,12 +973,11 @@ Connection objects
981973
currently executing query and cause it to raise a :exc:`DatabaseError`
982974
exception.
983975

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.
987978

988979

989-
.. method:: set_trace_callback(trace_callback)
980+
.. method:: set_trace_callback(trace_callback, /)
990981

991982
Register :term:`callable` *trace_callback* to be invoked
992983
for each SQL statement that is actually executed by the SQLite backend.
@@ -1009,9 +1000,8 @@ Connection objects
10091000

10101001
.. versionadded:: 3.3
10111002

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.
10151005

10161006

10171007
.. method:: enable_load_extension(enabled, /)

Doc/reference/lexical_analysis.rst

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Logical lines
3535

3636
.. index:: logical line, physical line, line joining, NEWLINE token
3737

38-
The end of a logical line is represented by the token NEWLINE. Statements
39-
cannot cross logical line boundaries except where NEWLINE is allowed by the
40-
syntax (e.g., between statements in compound statements). A logical line is
41-
constructed from one or more *physical lines* by following the explicit or
42-
implicit *line joining* rules.
38+
The end of a logical line is represented by the token :data:`~token.NEWLINE`.
39+
Statements cannot cross logical line boundaries except where :data:`!NEWLINE`
40+
is allowed by the syntax (e.g., between statements in compound statements).
41+
A logical line is constructed from one or more *physical lines* by following
42+
the explicit or implicit *line joining* rules.
4343

4444

4545
.. _physical-lines:
@@ -160,11 +160,12 @@ Blank lines
160160
.. index:: single: blank line
161161

162162
A logical line that contains only spaces, tabs, formfeeds and possibly a
163-
comment, is ignored (i.e., no NEWLINE token is generated). During interactive
164-
input of statements, handling of a blank line may differ depending on the
165-
implementation of the read-eval-print loop. In the standard interactive
166-
interpreter, an entirely blank logical line (i.e. one containing not even
167-
whitespace or a comment) terminates a multi-line statement.
163+
comment, is ignored (i.e., no :data:`~token.NEWLINE` token is generated).
164+
During interactive input of statements, handling of a blank line may differ
165+
depending on the implementation of the read-eval-print loop.
166+
In the standard interactive interpreter, an entirely blank logical line (that
167+
is, one containing not even whitespace or a comment) terminates a multi-line
168+
statement.
168169

169170

170171
.. _indentation:
@@ -202,19 +203,20 @@ the space count to zero).
202203

203204
.. index:: INDENT token, DEDENT token
204205

205-
The indentation levels of consecutive lines are used to generate INDENT and
206-
DEDENT tokens, using a stack, as follows.
206+
The indentation levels of consecutive lines are used to generate
207+
:data:`~token.INDENT` and :data:`~token.DEDENT` tokens, using a stack,
208+
as follows.
207209

208210
Before the first line of the file is read, a single zero is pushed on the stack;
209211
this will never be popped off again. The numbers pushed on the stack will
210212
always be strictly increasing from bottom to top. At the beginning of each
211213
logical line, the line's indentation level is compared to the top of the stack.
212214
If it is equal, nothing happens. If it is larger, it is pushed on the stack, and
213-
one INDENT token is generated. If it is smaller, it *must* be one of the
215+
one :data:`!INDENT` token is generated. If it is smaller, it *must* be one of the
214216
numbers occurring on the stack; all numbers on the stack that are larger are
215-
popped off, and for each number popped off a DEDENT token is generated. At the
216-
end of the file, a DEDENT token is generated for each number remaining on the
217-
stack that is larger than zero.
217+
popped off, and for each number popped off a :data:`!DEDENT` token is generated.
218+
At the end of the file, a :data:`!DEDENT` token is generated for each number
219+
remaining on the stack that is larger than zero.
218220

219221
Here is an example of a correctly (though confusingly) indented piece of Python
220222
code::
@@ -254,20 +256,34 @@ Whitespace between tokens
254256
Except at the beginning of a logical line or in string literals, the whitespace
255257
characters space, tab and formfeed can be used interchangeably to separate
256258
tokens. Whitespace is needed between two tokens only if their concatenation
257-
could otherwise be interpreted as a different token (e.g., ab is one token, but
258-
a b is two tokens).
259+
could otherwise be interpreted as a different token. For example, ``ab`` is one
260+
token, but ``a b`` is two tokens. However, ``+a`` and ``+ a`` both produce
261+
two tokens, ``+`` and ``a``, as ``+a`` is not a valid token.
262+
263+
264+
.. _endmarker-token:
265+
266+
End marker
267+
----------
268+
269+
At the end of non-interactive input, the lexical analyzer generates an
270+
:data:`~token.ENDMARKER` token.
259271

260272

261273
.. _other-tokens:
262274

263275
Other tokens
264276
============
265277

266-
Besides NEWLINE, INDENT and DEDENT, the following categories of tokens exist:
267-
*identifiers*, *keywords*, *literals*, *operators*, and *delimiters*. Whitespace
268-
characters (other than line terminators, discussed earlier) are not tokens, but
269-
serve to delimit tokens. Where ambiguity exists, a token comprises the longest
270-
possible string that forms a legal token, when read from left to right.
278+
Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` and :data:`~token.DEDENT`,
279+
the following categories of tokens exist:
280+
*identifiers* and *keywords* (:data:`~token.NAME`), *literals* (such as
281+
:data:`~token.NUMBER` and :data:`~token.STRING`), and other symbols
282+
(*operators* and *delimiters*, :data:`~token.OP`).
283+
Whitespace characters (other than logical line terminators, discussed earlier)
284+
are not tokens, but serve to delimit tokens.
285+
Where ambiguity exists, a token comprises the longest possible string that
286+
forms a legal token, when read from left to right.
271287

272288

273289
.. _identifiers:

Doc/tutorial/introduction.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ Python can manipulate text (represented by type :class:`str`, so-called
147147
"``Yay! :)``". They can be enclosed in single quotes (``'...'``) or double
148148
quotes (``"..."``) with the same result [#]_.
149149

150+
.. code-block:: pycon
151+
150152
>>> 'spam eggs' # single quotes
151153
'spam eggs'
152154
>>> "Paris rabbit got your back :)! Yay!" # double quotes

Doc/whatsnew/3.15.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,16 @@ New features
143143
Porting to Python 3.15
144144
----------------------
145145

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`.)
147156

148157
Deprecated C APIs
149158
-----------------

Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_global_strings.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ struct _Py_global_strings {
283283
STRUCT_FOR_ID(add_done_callback)
284284
STRUCT_FOR_ID(after_in_child)
285285
STRUCT_FOR_ID(after_in_parent)
286-
STRUCT_FOR_ID(aggregate_class)
287286
STRUCT_FOR_ID(alias)
288287
STRUCT_FOR_ID(align)
289288
STRUCT_FOR_ID(all)
@@ -300,7 +299,6 @@ struct _Py_global_strings {
300299
STRUCT_FOR_ID(ast)
301300
STRUCT_FOR_ID(athrow)
302301
STRUCT_FOR_ID(attribute)
303-
STRUCT_FOR_ID(authorizer_callback)
304302
STRUCT_FOR_ID(autocommit)
305303
STRUCT_FOR_ID(backtick)
306304
STRUCT_FOR_ID(base)
@@ -599,15 +597,13 @@ struct _Py_global_strings {
599597
STRUCT_FOR_ID(msg)
600598
STRUCT_FOR_ID(mutex)
601599
STRUCT_FOR_ID(mycmp)
602-
STRUCT_FOR_ID(n_arg)
603600
STRUCT_FOR_ID(n_fields)
604601
STRUCT_FOR_ID(n_sequence_fields)
605602
STRUCT_FOR_ID(n_unnamed_fields)
606603
STRUCT_FOR_ID(name)
607604
STRUCT_FOR_ID(name_from)
608605
STRUCT_FOR_ID(namespace_separator)
609606
STRUCT_FOR_ID(namespaces)
610-
STRUCT_FOR_ID(narg)
611607
STRUCT_FOR_ID(ndigits)
612608
STRUCT_FOR_ID(nested)
613609
STRUCT_FOR_ID(new_file_name)
@@ -665,7 +661,6 @@ struct _Py_global_strings {
665661
STRUCT_FOR_ID(print_file_and_line)
666662
STRUCT_FOR_ID(priority)
667663
STRUCT_FOR_ID(progress)
668-
STRUCT_FOR_ID(progress_handler)
669664
STRUCT_FOR_ID(progress_routine)
670665
STRUCT_FOR_ID(proto)
671666
STRUCT_FOR_ID(protocol)
@@ -771,7 +766,6 @@ struct _Py_global_strings {
771766
STRUCT_FOR_ID(timetuple)
772767
STRUCT_FOR_ID(timeunit)
773768
STRUCT_FOR_ID(top)
774-
STRUCT_FOR_ID(trace_callback)
775769
STRUCT_FOR_ID(traceback)
776770
STRUCT_FOR_ID(trailers)
777771
STRUCT_FOR_ID(translate)

Include/internal/pycore_long.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *);
158158
// Export for '_testclinic' shared extension (Argument Clinic code)
159159
PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *);
160160

161+
PyAPI_FUNC(int) _PyLong_UInt8_Converter(PyObject *, void *);
162+
PyAPI_FUNC(int) _PyLong_UInt16_Converter(PyObject *, void *);
163+
PyAPI_FUNC(int) _PyLong_UInt32_Converter(PyObject *, void *);
164+
PyAPI_FUNC(int) _PyLong_UInt64_Converter(PyObject *, void *);
165+
161166
/* Long value tag bits:
162167
* 0-1: Sign bits value = (1-sign), ie. negative=2, positive=0, zero=1.
163168
* 2: Set to 1 for the small ints

0 commit comments

Comments
 (0)