Skip to content

Commit 9c01810

Browse files
authored
Merge branch 'main' into complex-realimag-asdouble
2 parents b30c9f4 + b0699aa commit 9c01810

File tree

505 files changed

+8789
-5378
lines changed

Some content is hidden

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

505 files changed

+8789
-5378
lines changed

.github/ISSUE_TEMPLATE/bug.yml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ body:
3939
- "3.10"
4040
- "3.11"
4141
- "3.12"
42+
- "3.13"
4243
- "CPython main branch"
4344
validations:
4445
required: true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ gmon.out
4242
.coverage
4343
.mypy_cache/
4444
.pytest_cache/
45+
.ruff_cache/
4546
.DS_Store
4647

4748
*.exe

.pre-commit-config.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.0.292
3+
rev: v0.1.2
44
hooks:
55
- id: ruff
66
name: Run Ruff on Lib/test/
@@ -12,7 +12,7 @@ repos:
1212
files: ^Tools/clinic/|Lib/test/test_clinic.py
1313

1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.4.0
15+
rev: v4.5.0
1616
hooks:
1717
- id: check-toml
1818
exclude: ^Lib/test/test_tomllib/
@@ -24,12 +24,11 @@ repos:
2424
types_or: [c, inc, python, rst]
2525

2626
- repo: https://github.com/sphinx-contrib/sphinx-lint
27-
rev: v0.7.0
27+
rev: v0.8.1
2828
hooks:
2929
- id: sphinx-lint
30-
args: [--enable=default-role, -j1]
30+
args: [--enable=default-role]
3131
files: ^Doc/|^Misc/NEWS.d/next/
32-
types: [rst]
3332

3433
- repo: meta
3534
hooks:

Doc/c-api/arg.rst

+7-2
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,10 @@ API Functions
416416
.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
417417
418418
Parse the parameters of a function that takes both positional and keyword
419-
parameters into local variables. The *keywords* argument is a
420-
``NULL``-terminated array of keyword parameter names. Empty names denote
419+
parameters into local variables.
420+
The *keywords* argument is a ``NULL``-terminated array of keyword parameter
421+
names specified as null-terminated ASCII or UTF-8 encoded C strings.
422+
Empty names denote
421423
:ref:`positional-only parameters <positional-only_parameter>`.
422424
Returns true on success; on failure, it returns false and raises the
423425
appropriate exception.
@@ -426,6 +428,9 @@ API Functions
426428
Added support for :ref:`positional-only parameters
427429
<positional-only_parameter>`.
428430
431+
.. versionchanged:: 3.13
432+
Added support for non-ASCII keyword parameter names.
433+
429434
430435
.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
431436

Doc/c-api/call.rst

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ This is a pointer to a function with the following signature:
108108
Doing so will allow callables such as bound methods to make their onward
109109
calls (which include a prepended *self* argument) very efficiently.
110110

111+
.. versionadded:: 3.8
112+
111113
To call an object that implements vectorcall, use a :ref:`call API <capi-call>`
112114
function as with any other callable.
113115
:c:func:`PyObject_Vectorcall` will usually be most efficient.

Doc/c-api/init_config.rst

+18-3
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ PyConfig
716716
717717
Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable.
718718
719-
Need a special build of Python with the ``Py_TRACE_REFS`` macro defined:
719+
Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined:
720720
see the :option:`configure --with-trace-refs option <--with-trace-refs>`.
721721
722722
Default: ``0``.
@@ -1048,7 +1048,7 @@ PyConfig
10481048
Incremented by the :option:`-d` command line option. Set to the
10491049
:envvar:`PYTHONDEBUG` environment variable value.
10501050
1051-
Need a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
1051+
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
10521052
must be defined).
10531053
10541054
Default: ``0``.
@@ -1100,6 +1100,7 @@ PyConfig
11001100
11011101
Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and
11021102
the :envvar:`PYTHONPYCACHEPREFIX` environment variable.
1103+
The command-line option takes precedence.
11031104
11041105
If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``.
11051106
@@ -1143,13 +1144,27 @@ PyConfig
11431144
11441145
Default: ``NULL``.
11451146
1147+
.. c:member:: wchar_t* run_presite
1148+
1149+
``package.module`` path to module that should be imported before
1150+
``site.py`` is run.
1151+
1152+
Set by the :option:`-X presite=package.module <-X>` command-line
1153+
option and the :envvar:`PYTHON_PRESITE` environment variable.
1154+
The command-line option takes precedence.
1155+
1156+
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
1157+
must be defined).
1158+
1159+
Default: ``NULL``.
1160+
11461161
.. c:member:: int show_ref_count
11471162
11481163
Show total reference count at exit (excluding immortal objects)?
11491164
11501165
Set to ``1`` by :option:`-X showrefcount <-X>` command line option.
11511166
1152-
Need a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
1167+
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
11531168
macro must be defined).
11541169
11551170
Default: ``0``.

Doc/c-api/memory.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ The pymalloc allocator
626626
627627
Python has a *pymalloc* allocator optimized for small objects (smaller or equal
628628
to 512 bytes) with a short lifetime. It uses memory mappings called "arenas"
629-
with a fixed size of 256 KiB. It falls back to :c:func:`PyMem_RawMalloc` and
629+
with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB on 64-bit
630+
platforms. It falls back to :c:func:`PyMem_RawMalloc` and
630631
:c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes.
631632
632633
*pymalloc* is the :ref:`default allocator <default-memory-allocators>` of the

Doc/c-api/set.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,6 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
163163
164164
.. c:function:: int PySet_Clear(PyObject *set)
165165
166-
Empty an existing set of all elements.
166+
Empty an existing set of all elements. Return ``0`` on
167+
success. Return ``-1`` and raise :exc:`SystemError` if *set* is not an instance of
168+
:class:`set` or its subtype.

Doc/c-api/unicode.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,8 @@ These are the UTF-8 codec APIs:
971971
returned buffer always has an extra null byte appended (not included in
972972
*size*), regardless of whether there are any other null code points.
973973
974-
In the case of an error, ``NULL`` is returned with an exception set and no
975-
*size* is stored.
974+
On error, set an exception, set *size* to ``-1`` (if it's not NULL) and
975+
return ``NULL``.
976976
977977
This caches the UTF-8 representation of the string in the Unicode object, and
978978
subsequent calls will return a pointer to the same buffer. The caller is not
@@ -992,11 +992,19 @@ These are the UTF-8 codec APIs:
992992
993993
As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size.
994994
995+
Raise an exception if the *unicode* string contains embedded null
996+
characters. To accept embedded null characters and truncate on purpose
997+
at the first null byte, ``PyUnicode_AsUTF8AndSize(unicode, NULL)`` can be
998+
used instead.
999+
9951000
.. versionadded:: 3.3
9961001
9971002
.. versionchanged:: 3.7
9981003
The return type is now ``const char *`` rather of ``char *``.
9991004
1005+
.. versionchanged:: 3.13
1006+
Raise an exception if the string contains embedded null characters.
1007+
10001008
10011009
UTF-32 Codecs
10021010
"""""""""""""

Doc/data/stable_abi.dat

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/glossary.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Glossary
239239

240240
context manager
241241
An object which controls the environment seen in a :keyword:`with`
242-
statement by defining :meth:`__enter__` and :meth:`__exit__` methods.
242+
statement by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods.
243243
See :pep:`343`.
244244

245245
context variable
@@ -636,7 +636,7 @@ Glossary
636636
iterables include all sequence types (such as :class:`list`, :class:`str`,
637637
and :class:`tuple`) and some non-sequence types like :class:`dict`,
638638
:term:`file objects <file object>`, and objects of any classes you define
639-
with an :meth:`__iter__` method or with a :meth:`__getitem__` method
639+
with an :meth:`__iter__` method or with a :meth:`~object.__getitem__` method
640640
that implements :term:`sequence` semantics.
641641

642642
Iterables can be
@@ -1078,17 +1078,17 @@ Glossary
10781078

10791079
sequence
10801080
An :term:`iterable` which supports efficient element access using integer
1081-
indices via the :meth:`__getitem__` special method and defines a
1081+
indices via the :meth:`~object.__getitem__` special method and defines a
10821082
:meth:`__len__` method that returns the length of the sequence.
10831083
Some built-in sequence types are :class:`list`, :class:`str`,
10841084
:class:`tuple`, and :class:`bytes`. Note that :class:`dict` also
1085-
supports :meth:`__getitem__` and :meth:`__len__`, but is considered a
1085+
supports :meth:`~object.__getitem__` and :meth:`__len__`, but is considered a
10861086
mapping rather than a sequence because the lookups use arbitrary
10871087
:term:`immutable` keys rather than integers.
10881088

10891089
The :class:`collections.abc.Sequence` abstract base class
10901090
defines a much richer interface that goes beyond just
1091-
:meth:`__getitem__` and :meth:`__len__`, adding :meth:`count`,
1091+
:meth:`~object.__getitem__` and :meth:`__len__`, adding :meth:`count`,
10921092
:meth:`index`, :meth:`__contains__`, and
10931093
:meth:`__reversed__`. Types that implement this expanded
10941094
interface can be registered explicitly using

Doc/howto/regex.rst

+3
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ You can omit either *m* or *n*; in that case, a reasonable value is assumed for
245245
the missing value. Omitting *m* is interpreted as a lower limit of 0, while
246246
omitting *n* results in an upper bound of infinity.
247247

248+
The simplest case ``{m}`` matches the preceding item exactly *m* times.
249+
For example, ``a/{2}b`` will only match ``'a//b'``.
250+
248251
Readers of a reductionist bent may notice that the three other quantifiers can
249252
all be expressed using this notation. ``{0,}`` is the same as ``*``, ``{1,}``
250253
is equivalent to ``+``, and ``{0,1}`` is the same as ``?``. It's better to use

Doc/library/abc.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
154154
Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
155155
even though it does not define an :meth:`~iterator.__iter__` method (it uses
156156
the old-style iterable protocol, defined in terms of :meth:`__len__` and
157-
:meth:`__getitem__`). Note that this will not make ``get_iterator``
157+
:meth:`~object.__getitem__`). Note that this will not make ``get_iterator``
158158
available as a method of ``Foo``, so it is provided separately.
159159

160160

Doc/library/asyncio-eventloop.rst

+17-3
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ Scheduling callbacks
243243
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
244244
section of the documentation.
245245

246-
.. versionchanged:: 3.7
247-
The *context* keyword-only parameter was added. See :pep:`567`
248-
for more details.
246+
.. versionchanged:: 3.7
247+
The *context* keyword-only parameter was added. See :pep:`567`
248+
for more details.
249249

250250
.. _asyncio-pass-keywords:
251251

@@ -661,6 +661,8 @@ Opening network connections
661661
Creating network servers
662662
^^^^^^^^^^^^^^^^^^^^^^^^
663663

664+
.. _loop_create_server:
665+
664666
.. coroutinemethod:: loop.create_server(protocol_factory, \
665667
host=None, port=None, *, \
666668
family=socket.AF_UNSPEC, \
@@ -1191,6 +1193,8 @@ Working with pipes
11911193
Unix signals
11921194
^^^^^^^^^^^^
11931195

1196+
.. _loop_add_signal_handler:
1197+
11941198
.. method:: loop.add_signal_handler(signum, callback, *args)
11951199

11961200
Set *callback* as the handler for the *signum* signal.
@@ -1391,6 +1395,14 @@ Enabling debug mode
13911395
The new :ref:`Python Development Mode <devmode>` can now also be used
13921396
to enable the debug mode.
13931397

1398+
.. attribute:: loop.slow_callback_duration
1399+
1400+
This attribute can be used to set the
1401+
minimum execution duration in seconds that is considered "slow".
1402+
When debug mode is enabled, "slow" callbacks are logged.
1403+
1404+
Default value is 100 milliseconds.
1405+
13941406
.. seealso::
13951407

13961408
The :ref:`debug mode of asyncio <asyncio-debug-mode>`.
@@ -1411,6 +1423,8 @@ async/await code consider using the high-level
14111423
:ref:`Subprocess Support on Windows <asyncio-windows-subprocess>` for
14121424
details.
14131425

1426+
.. _loop_subprocess_exec:
1427+
14141428
.. coroutinemethod:: loop.subprocess_exec(protocol_factory, *args, \
14151429
stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
14161430
stderr=subprocess.PIPE, **kwargs)

Doc/library/asyncio-task.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ Shielding From Cancellation
592592

593593
is equivalent to::
594594

595-
res = await shield(something())
595+
res = await something()
596596

597597
*except* that if the coroutine containing it is cancelled, the
598598
Task running in ``something()`` is not cancelled. From the point

Doc/library/asyncio.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ Additionally, there are **low-level** APIs for
4646
*library and framework developers* to:
4747

4848
* create and manage :ref:`event loops <asyncio-event-loop>`, which
49-
provide asynchronous APIs for :meth:`networking <loop.create_server>`,
50-
running :meth:`subprocesses <loop.subprocess_exec>`,
51-
handling :meth:`OS signals <loop.add_signal_handler>`, etc;
49+
provide asynchronous APIs for :ref:`networking <loop_create_server>`,
50+
running :ref:`subprocesses <loop_subprocess_exec>`,
51+
handling :ref:`OS signals <loop_add_signal_handler>`, etc;
5252

5353
* implement efficient protocols using
5454
:ref:`transports <asyncio-transports-protocols>`;

0 commit comments

Comments
 (0)