Skip to content

Commit 2d78182

Browse files
Merge branch '3.13' into backport-9d64c35-3.13
2 parents 0962402 + 2d322c4 commit 2d78182

94 files changed

Lines changed: 722 additions & 213 deletions

File tree

Some content is hidden

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

Doc/c-api/exceptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ an error value).
412412
413413
.. c:function:: int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...)
414414
415-
Function similar to :c:func:`PyErr_WarnEx`, but use
415+
Function similar to :c:func:`PyErr_WarnEx`, but uses
416416
:c:func:`PyUnicode_FromFormat` to format the warning message. *format* is
417417
an ASCII-encoded string.
418418

Doc/c-api/typehints.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ two types exist -- :ref:`GenericAlias <types-genericalias>` and
3131
static PyMethodDef my_obj_methods[] = {
3232
// Other methods.
3333
...
34-
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, "See PEP 585"}
34+
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, "my_obj is generic over its contained type"}
3535
...
3636
}
3737

Doc/conf.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88

99
import os
1010
import sys
11-
from importlib import import_module
1211
from importlib.util import find_spec
1312

1413
# Make our custom extensions available to Sphinx
1514
sys.path.append(os.path.abspath('tools/extensions'))
1615
sys.path.append(os.path.abspath('includes'))
1716

18-
# Python specific content from Doc/Tools/extensions/pyspecific.py
19-
from pyspecific import SOURCE_URI
17+
from patchlevel import get_header_version_info, get_version_info
2018

2119
# General configuration
2220
# ---------------------
@@ -75,7 +73,7 @@
7573
# We look for the Include/patchlevel.h file in the current Python source tree
7674
# and replace the values accordingly.
7775
# See Doc/tools/extensions/patchlevel.py
78-
version, release = import_module('patchlevel').get_version_info()
76+
version, release = get_version_info()
7977

8078
rst_epilog = f"""
8179
.. |python_version_literal| replace:: ``Python {version}``
@@ -547,16 +545,20 @@
547545
r'https://unix.org/version2/whatsnew/lp64_wp.html',
548546
]
549547

548+
550549
# Options for sphinx.ext.extlinks
551550
# -------------------------------
552551

552+
v = get_header_version_info()
553+
branch = "main" if v.releaselevel == "alpha" else f"{v.major}.{v.minor}"
554+
553555
# This config is a dictionary of external sites,
554556
# mapping unique short aliases to a base URL and a prefix.
555557
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
556558
extlinks = {
557559
"oss-fuzz": ("https://issues.oss-fuzz.com/issues/%s", "#%s"),
558560
"pypi": ("https://pypi.org/project/%s/", "%s"),
559-
"source": (SOURCE_URI, "%s"),
561+
"source": (f"https://github.com/python/cpython/tree/{branch}/%s", "%s"),
560562
}
561563
extlinks_detect_hardcoded_links = True
562564

Doc/data/stable_abi.dat

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/howto/functional.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ first calculation. ::
10421042
>>> functools.reduce(operator.concat, [])
10431043
Traceback (most recent call last):
10441044
...
1045-
TypeError: reduce() of empty sequence with no initial value
1045+
TypeError: reduce() of empty iterable with no initial value
10461046
>>> functools.reduce(operator.mul, [1, 2, 3], 1)
10471047
6
10481048
>>> functools.reduce(operator.mul, [], 1)

Doc/library/_thread.rst

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ This module defines the following constants and functions:
3636
This is now a synonym of the built-in :exc:`RuntimeError`.
3737

3838

39-
.. data:: LockType
40-
41-
This is the type of lock objects.
42-
43-
4439
.. function:: start_new_thread(function, args[, kwargs])
4540

4641
Start a new thread and return its identifier. The thread executes the
@@ -159,55 +154,63 @@ This module defines the following constants and functions:
159154
.. versionadded:: 3.2
160155

161156

162-
Lock objects have the following methods:
157+
.. raw:: html
158+
159+
<!-- Keep the old URL fragments working (see gh-89554) -->
160+
<span id='thread.lock.acquire'></span>
161+
<span id='thread.lock.release'></span>
162+
<span id='thread.lock.locked'></span>
163163

164+
.. class:: LockType
164165

165-
.. method:: lock.acquire(blocking=True, timeout=-1)
166+
This is the type of lock objects.
166167

167-
Without any optional argument, this method acquires the lock unconditionally, if
168-
necessary waiting until it is released by another thread (only one thread at a
169-
time can acquire a lock --- that's their reason for existence).
168+
Lock objects have the following methods:
170169

171-
If the *blocking* argument is present, the action depends on its
172-
value: if it is false, the lock is only acquired if it can be acquired
173-
immediately without waiting, while if it is true, the lock is acquired
174-
unconditionally as above.
170+
.. method:: acquire(blocking=True, timeout=-1)
175171

176-
If the floating-point *timeout* argument is present and positive, it
177-
specifies the maximum wait time in seconds before returning. A negative
178-
*timeout* argument specifies an unbounded wait. You cannot specify
179-
a *timeout* if *blocking* is false.
172+
Without any optional argument, this method acquires the lock unconditionally, if
173+
necessary waiting until it is released by another thread (only one thread at a
174+
time can acquire a lock --- that's their reason for existence).
180175

181-
The return value is ``True`` if the lock is acquired successfully,
182-
``False`` if not.
176+
If the *blocking* argument is present, the action depends on its
177+
value: if it is false, the lock is only acquired if it can be acquired
178+
immediately without waiting, while if it is true, the lock is acquired
179+
unconditionally as above.
183180

184-
.. versionchanged:: 3.2
185-
The *timeout* parameter is new.
181+
If the floating-point *timeout* argument is present and positive, it
182+
specifies the maximum wait time in seconds before returning. A negative
183+
*timeout* argument specifies an unbounded wait. You cannot specify
184+
a *timeout* if *blocking* is false.
186185

187-
.. versionchanged:: 3.2
188-
Lock acquires can now be interrupted by signals on POSIX.
186+
The return value is ``True`` if the lock is acquired successfully,
187+
``False`` if not.
189188

189+
.. versionchanged:: 3.2
190+
The *timeout* parameter is new.
190191

191-
.. method:: lock.release()
192+
.. versionchanged:: 3.2
193+
Lock acquires can now be interrupted by signals on POSIX.
192194

193-
Releases the lock. The lock must have been acquired earlier, but not
194-
necessarily by the same thread.
195+
.. method:: release()
195196

197+
Releases the lock. The lock must have been acquired earlier, but not
198+
necessarily by the same thread.
196199

197-
.. method:: lock.locked()
200+
.. method:: locked()
198201

199-
Return the status of the lock: ``True`` if it has been acquired by some thread,
200-
``False`` if not.
202+
Return the status of the lock: ``True`` if it has been acquired by some thread,
203+
``False`` if not.
201204

202-
In addition to these methods, lock objects can also be used via the
203-
:keyword:`with` statement, e.g.::
205+
In addition to these methods, lock objects can also be used via the
206+
:keyword:`with` statement, e.g.::
204207

205-
import _thread
208+
import _thread
206209

207-
a_lock = _thread.allocate_lock()
210+
a_lock = _thread.allocate_lock()
208211

209-
with a_lock:
210-
print("a_lock is locked while this executes")
212+
with a_lock:
213+
print("a_lock is locked while this executes")
211214

212215
**Caveats:**
213216

Doc/library/array.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ The module defines the following type:
9999
:exc:`TypeError` is raised. Array objects also implement the buffer interface,
100100
and may be used wherever :term:`bytes-like objects <bytes-like object>` are supported.
101101

102+
Arrays are :ref:`generic <generics>` over the type of their contents.
103+
102104
.. audit-event:: array.__new__ typecode,initializer array.array
103105

104106

Doc/library/asyncio-future.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ Future Object
100100
implementations can inject their own optimized implementations
101101
of a Future object.
102102

103+
Futures are :ref:`generic <generics>` over the type of their results.
104+
103105
.. versionchanged:: 3.7
104106
Added support for the :mod:`contextvars` module.
105107

Doc/library/asyncio-task.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,9 @@ Task object
11901190
blocks. If the coroutine returns or raises without blocking, the task
11911191
will be finished eagerly and will skip scheduling to the event loop.
11921192

1193+
Tasks are :ref:`generic <generics>` over the return type of their wrapped
1194+
coroutines.
1195+
11931196
.. versionchanged:: 3.7
11941197
Added support for the :mod:`contextvars` module.
11951198

Doc/library/bisect.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ example uses :py:func:`~bisect.bisect` to look up a letter grade for an exam sco
203203
based on a set of ordered numeric breakpoints: 90 and up is an 'A', 80 to 89 is
204204
a 'B', and so on::
205205

206-
>>> def grade(score)
206+
>>> def grade(score):
207207
... i = bisect([60, 70, 80, 90], score)
208208
... return "FDCBA"[i]
209209
...

0 commit comments

Comments
 (0)