Skip to content

Commit 658c266

Browse files
authored
Merge branch 'main' into hex-format
2 parents b02a5c7 + c65ae26 commit 658c266

File tree

163 files changed

+2658
-1393
lines changed

Some content is hidden

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

163 files changed

+2658
-1393
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ jobs:
142142
run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
143143
- name: Configure ccache action
144144
uses: hendrikmuhs/[email protected]
145+
with:
146+
save: ${{ github.event_name == 'push' }}
145147
- name: Check Autoconf and aclocal versions
146148
run: |
147149
grep "Generated by GNU Autoconf 2.71" configure
@@ -284,6 +286,8 @@ jobs:
284286
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
285287
- name: Configure ccache action
286288
uses: hendrikmuhs/[email protected]
289+
with:
290+
save: ${{ github.event_name == 'push' }}
287291
- name: Configure CPython
288292
run: ./configure --config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
289293
- name: Build CPython
@@ -327,6 +331,8 @@ jobs:
327331
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
328332
- name: Configure ccache action
329333
uses: hendrikmuhs/[email protected]
334+
with:
335+
save: ${{ github.event_name == 'push' }}
330336
- name: Setup directory envs for out-of-tree builds
331337
run: |
332338
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
@@ -446,6 +452,8 @@ jobs:
446452
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
447453
- name: Configure ccache action
448454
uses: hendrikmuhs/[email protected]
455+
with:
456+
save: ${{ github.event_name == 'push' }}
449457
- name: Configure CPython
450458
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
451459
- name: Build CPython

.github/workflows/reusable-ubuntu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
4242
- name: Configure ccache action
4343
uses: hendrikmuhs/[email protected]
44+
with:
45+
save: ${{ github.event_name == 'push' }}
4446
- name: Setup directory envs for out-of-tree builds
4547
run: |
4648
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV

Doc/c-api/object.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ Object Protocol
4747
4848
.. c:function:: int PyObject_HasAttr(PyObject *o, PyObject *attr_name)
4949
50-
Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This
51-
is equivalent to the Python expression ``hasattr(o, attr_name)``. This function
52-
always succeeds.
50+
Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise.
51+
This function always succeeds.
5352
5453
.. note::
5554

Doc/faq/design.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ on the key and a per-process seed; for example, ``'Python'`` could hash to
451451
to ``1142331976``. The hash code is then used to calculate a location in an
452452
internal array where the value will be stored. Assuming that you're storing
453453
keys that all have different hash values, this means that dictionaries take
454-
constant time -- O(1), in Big-O notation -- to retrieve a key.
454+
constant time -- *O*\ (1), in Big-O notation -- to retrieve a key.
455455

456456

457457
Why must dictionary keys be immutable?

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ Glossary
742742
list
743743
A built-in Python :term:`sequence`. Despite its name it is more akin
744744
to an array in other languages than to a linked list since access to
745-
elements is O(1).
745+
elements is *O*\ (1).
746746

747747
list comprehension
748748
A compact way to process all or part of the elements in a sequence and

Doc/howto/descriptor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ instance::
12501250
<function D.f at 0x00C45070>
12511251

12521252
>>> d.f.__self__
1253-
<__main__.D object at 0x1012e1f98>
1253+
<__main__.D object at 0x00B18C90>
12541254

12551255
If you have ever wondered where *self* comes from in regular methods or where
12561256
*cls* comes from in class methods, this is it!

Doc/library/asyncio-policy.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ implementation used by the asyncio event loop:
237237

238238
It works reliably even when the asyncio event loop is run in a non-main OS thread.
239239

240-
There is no noticeable overhead when handling a big number of children (*O(1)* each
240+
There is no noticeable overhead when handling a big number of children (*O*\ (1) each
241241
time a child terminates), but starting a thread per process requires extra memory.
242242

243243
This watcher is used by default.
@@ -257,7 +257,7 @@ implementation used by the asyncio event loop:
257257
watcher is installed.
258258

259259
The solution is safe but it has a significant overhead when
260-
handling a big number of processes (*O(n)* each time a
260+
handling a big number of processes (*O*\ (*n*) each time a
261261
:py:data:`SIGCHLD` is received).
262262

263263
.. versionadded:: 3.8
@@ -273,7 +273,7 @@ implementation used by the asyncio event loop:
273273
The watcher avoids disrupting other code spawning processes
274274
by polling every process explicitly on a :py:data:`SIGCHLD` signal.
275275

276-
This solution is as safe as :class:`MultiLoopChildWatcher` and has the same *O(N)*
276+
This solution is as safe as :class:`MultiLoopChildWatcher` and has the same *O*\ (*n*)
277277
complexity but requires a running event loop in the main thread to work.
278278

279279
.. deprecated:: 3.12
@@ -285,7 +285,7 @@ implementation used by the asyncio event loop:
285285
processes and waiting for their termination.
286286

287287
There is no noticeable overhead when handling a big number of
288-
children (*O(1)* each time a child terminates).
288+
children (*O*\ (1) each time a child terminates).
289289

290290
This solution requires a running event loop in the main thread to work, as
291291
:class:`SafeChildWatcher`.

Doc/library/bisect.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The following functions are provided:
7979
To support inserting records in a table, the *key* function (if any) is
8080
applied to *x* for the search step but not for the insertion step.
8181

82-
Keep in mind that the ``O(log n)`` search is dominated by the slow O(n)
82+
Keep in mind that the *O*\ (log *n*) search is dominated by the slow *O*\ (*n*)
8383
insertion step.
8484

8585
.. versionchanged:: 3.10
@@ -99,7 +99,7 @@ The following functions are provided:
9999
To support inserting records in a table, the *key* function (if any) is
100100
applied to *x* for the search step but not for the insertion step.
101101

102-
Keep in mind that the ``O(log n)`` search is dominated by the slow O(n)
102+
Keep in mind that the *O*\ (log *n*) search is dominated by the slow *O*\ (*n*)
103103
insertion step.
104104

105105
.. versionchanged:: 3.10
@@ -115,7 +115,7 @@ thoughts in mind:
115115
* Bisection is effective for searching ranges of values.
116116
For locating specific values, dictionaries are more performant.
117117

118-
* The *insort()* functions are ``O(n)`` because the logarithmic search step
118+
* The *insort()* functions are *O*\ (*n*) because the logarithmic search step
119119
is dominated by the linear time insertion step.
120120

121121
* The search functions are stateless and discard key function results after

Doc/library/collections.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,10 @@ or subtracting from an empty counter.
458458
Deques are a generalization of stacks and queues (the name is pronounced "deck"
459459
and is short for "double-ended queue"). Deques support thread-safe, memory
460460
efficient appends and pops from either side of the deque with approximately the
461-
same O(1) performance in either direction.
461+
same *O*\ (1) performance in either direction.
462462

463463
Though :class:`list` objects support similar operations, they are optimized for
464-
fast fixed-length operations and incur O(n) memory movement costs for
464+
fast fixed-length operations and incur *O*\ (*n*) memory movement costs for
465465
``pop(0)`` and ``insert(0, v)`` operations which change both the size and
466466
position of the underlying data representation.
467467

@@ -585,7 +585,7 @@ or subtracting from an empty counter.
585585
In addition to the above, deques support iteration, pickling, ``len(d)``,
586586
``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing with
587587
the :keyword:`in` operator, and subscript references such as ``d[0]`` to access
588-
the first element. Indexed access is O(1) at both ends but slows to O(n) in
588+
the first element. Indexed access is *O*\ (1) at both ends but slows to *O*\ (*n*) in
589589
the middle. For fast random access, use lists instead.
590590

591591
Starting in version 3.5, deques support ``__add__()``, ``__mul__()``,

Doc/library/contextvars.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Manual Context Management
131131
ctx: Context = copy_context()
132132
print(list(ctx.items()))
133133

134-
The function has an O(1) complexity, i.e. works equally fast for
134+
The function has an *O*\ (1) complexity, i.e. works equally fast for
135135
contexts with a few context variables and for contexts that have
136136
a lot of them.
137137

0 commit comments

Comments
 (0)