Skip to content

Commit 1514f5a

Browse files
committed
Deploying to gh-pages from @ 6fcd273 🚀
1 parent ea2fe98 commit 1514f5a

File tree

535 files changed

+766
-1322
lines changed

Some content is hidden

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

535 files changed

+766
-1322
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: e7ec7013a5b3e2ddcf33529b2d5be2bb
3+
config: a722cb470f646be1f9759369084d7fc6
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/library/functools.rst.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,9 @@ The :mod:`functools` module defines the following functions:
644644
attributes of the wrapper function are updated with the corresponding attributes
645645
from the original function. The default values for these arguments are the
646646
module level constants ``WRAPPER_ASSIGNMENTS`` (which assigns to the wrapper
647-
function's ``__module__``, ``__name__``, ``__qualname__``, ``__annotations__``
648-
and ``__doc__``, the documentation string) and ``WRAPPER_UPDATES`` (which
647+
function's ``__module__``, ``__name__``, ``__qualname__``, ``__annotations__``,
648+
``__type_params__``, and ``__doc__``, the documentation string)
649+
and ``WRAPPER_UPDATES`` (which
649650
updates the wrapper function's ``__dict__``, i.e. the instance dictionary).
650651

651652
To allow access to the original function for introspection and other purposes
@@ -675,6 +676,9 @@ The :mod:`functools` module defines the following functions:
675676
function, even if that function defined a ``__wrapped__`` attribute.
676677
(see :issue:`17482`)
677678

679+
.. versionchanged:: 3.12
680+
The ``__type_params__`` attribute is now copied by default.
681+
678682

679683
.. decorator:: wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
680684

_sources/library/itertools.rst.txt

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ loops that truncate the stream.
122122
# accumulate([1,2,3,4,5]) → 1 3 6 10 15
123123
# accumulate([1,2,3,4,5], initial=100) → 100 101 103 106 110 115
124124
# accumulate([1,2,3,4,5], operator.mul) → 1 2 6 24 120
125-
it = iter(iterable)
125+
iterator = iter(iterable)
126126
total = initial
127127
if initial is None:
128128
try:
129-
total = next(it)
129+
total = next(iterator)
130130
except StopIteration:
131131
return
132132
yield total
133-
for element in it:
133+
for element in iterator:
134134
total = func(total, element)
135135
yield total
136136

@@ -210,9 +210,8 @@ loops that truncate the stream.
210210

211211
def chain(*iterables):
212212
# chain('ABC', 'DEF') → A B C D E F
213-
for it in iterables:
214-
for element in it:
215-
yield element
213+
for iterable in iterables:
214+
yield from iterable
216215

217216

218217
.. classmethod:: chain.from_iterable(iterable)
@@ -222,9 +221,8 @@ loops that truncate the stream.
222221

223222
def from_iterable(iterables):
224223
# chain.from_iterable(['ABC', 'DEF']) → A B C D E F
225-
for it in iterables:
226-
for element in it:
227-
yield element
224+
for iterable in iterables:
225+
yield from iterable
228226

229227

230228
.. function:: combinations(iterable, r)
@@ -372,7 +370,7 @@ loops that truncate the stream.
372370
saved.append(element)
373371
while saved:
374372
for element in saved:
375-
yield element
373+
yield element
376374

377375
Note, this member of the toolkit may require significant auxiliary storage
378376
(depending on the length of the iterable).
@@ -607,10 +605,10 @@ loops that truncate the stream.
607605
This function is roughly equivalent to the following code, except that the
608606
actual implementation does not build up intermediate results in memory::
609607

610-
def product(*args, repeat=1):
608+
def product(*iterables, repeat=1):
611609
# product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy
612610
# product(range(2), repeat=3) → 000 001 010 011 100 101 110 111
613-
pools = [tuple(pool) for pool in args] * repeat
611+
pools = [tuple(pool) for pool in iterables] * repeat
614612
result = [[]]
615613
for pool in pools:
616614
result = [x+[y] for x in result for y in pool]
@@ -688,24 +686,22 @@ loops that truncate the stream.
688686

689687
Return *n* independent iterators from a single iterable.
690688

691-
The following Python code helps explain what *tee* does (although the actual
692-
implementation is more complex and uses only a single underlying
693-
:abbr:`FIFO (first-in, first-out)` queue)::
689+
Roughly equivalent to::
694690

695691
def tee(iterable, n=2):
696-
it = iter(iterable)
697-
deques = [collections.deque() for i in range(n)]
698-
def gen(mydeque):
699-
while True:
700-
if not mydeque: # when the local deque is empty
701-
try:
702-
newval = next(it) # fetch a new value and
703-
except StopIteration:
704-
return
705-
for d in deques: # load it to all the deques
706-
d.append(newval)
707-
yield mydeque.popleft()
708-
return tuple(gen(d) for d in deques)
692+
iterator = iter(iterable)
693+
empty_link = [None, None] # Singly linked list: [value, link]
694+
return tuple(_tee(iterator, empty_link) for _ in range(n))
695+
696+
def _tee(iterator, link):
697+
while True:
698+
if link[1] is None:
699+
try:
700+
link[:] = [next(iterator), [None, None]]
701+
except StopIteration:
702+
return
703+
value, link = link
704+
yield value
709705

710706
Once a :func:`tee` has been created, the original *iterable* should not be
711707
used anywhere else; otherwise, the *iterable* could get advanced without
@@ -727,17 +723,17 @@ loops that truncate the stream.
727723
iterables are of uneven length, missing values are filled-in with *fillvalue*.
728724
Iteration continues until the longest iterable is exhausted. Roughly equivalent to::
729725

730-
def zip_longest(*args, fillvalue=None):
726+
def zip_longest(*iterables, fillvalue=None):
731727
# zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-
732-
iterators = [iter(it) for it in args]
728+
iterators = [iter(it) for it in iterables]
733729
num_active = len(iterators)
734730
if not num_active:
735731
return
736732
while True:
737733
values = []
738-
for i, it in enumerate(iterators):
734+
for i, iterator in enumerate(iterators):
739735
try:
740-
value = next(it)
736+
value = next(iterator)
741737
except StopIteration:
742738
num_active -= 1
743739
if not num_active:
@@ -792,6 +788,7 @@ and :term:`generators <generator>` which incur interpreter overhead.
792788
.. testcode::
793789

794790
import collections
791+
import contextlib
795792
import functools
796793
import math
797794
import operator
@@ -934,32 +931,26 @@ and :term:`generators <generator>` which incur interpreter overhead.
934931
# iter_index('AABCADEAF', 'A') → 0 1 4 7
935932
seq_index = getattr(iterable, 'index', None)
936933
if seq_index is None:
937-
# Path for general iterables
938934
iterator = islice(iterable, start, stop)
939935
for i, element in enumerate(iterator, start):
940936
if element is value or element == value:
941937
yield i
942938
else:
943-
# Path for sequences with an index() method
944939
stop = len(iterable) if stop is None else stop
945940
i = start
946-
try:
941+
with contextlib.suppress(ValueError):
947942
while True:
948943
yield (i := seq_index(value, i, stop))
949944
i += 1
950-
except ValueError:
951-
pass
952945

953946
def iter_except(func, exception, first=None):
954947
"Convert a call-until-exception interface to an iterator interface."
955948
# iter_except(d.popitem, KeyError) → non-blocking dictionary iterator
956-
try:
949+
with contextlib.suppress(exception):
957950
if first is not None:
958951
yield first()
959952
while True:
960953
yield func()
961-
except exception:
962-
pass
963954

964955

965956
The following recipes have a more mathematical flavor:

_sources/library/os.rst.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,10 @@ features:
23562356
platform-dependent. On some platforms, they are ignored and you should call
23572357
:func:`chmod` explicitly to set them.
23582358

2359+
On Windows, a *mode* of ``0o700`` is specifically handled to apply access
2360+
control to the new directory such that only the current user and
2361+
administrators have access. Other values of *mode* are ignored.
2362+
23592363
This function can also support :ref:`paths relative to directory descriptors
23602364
<dir_fd>`.
23612365

@@ -2370,6 +2374,9 @@ features:
23702374
.. versionchanged:: 3.6
23712375
Accepts a :term:`path-like object`.
23722376

2377+
.. versionchanged:: 3.12.4
2378+
Windows now handles a *mode* of ``0o700``.
2379+
23732380

23742381
.. function:: makedirs(name, mode=0o777, exist_ok=False)
23752382

_sources/library/pathlib.rst.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,10 @@ Pure paths provide the following methods and properties:
582582
>>> PurePath('a/b.py').match(pattern)
583583
True
584584

585+
.. note::
586+
The recursive wildcard "``**``" isn't supported by this method (it acts
587+
like non-recursive "``*``".)
588+
585589
.. versionchanged:: 3.12
586590
Accepts an object implementing the :class:`os.PathLike` interface.
587591

_sources/library/secrets.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ randomness that your operating system provides.
4242
sources provided by the operating system. See
4343
:class:`random.SystemRandom` for additional details.
4444

45-
.. function:: choice(sequence)
45+
.. function:: choice(seq)
4646

4747
Return a randomly chosen element from a non-empty sequence.
4848

49-
.. function:: randbelow(n)
49+
.. function:: randbelow(exclusive_upper_bound)
5050

51-
Return a random int in the range [0, *n*).
51+
Return a random int in the range [0, *exclusive_upper_bound*).
5252

5353
.. function:: randbits(k)
5454

_sources/library/shutil.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ Directory and files operations
338338
before removing the junction.
339339

340340
.. versionchanged:: 3.11
341-
The *dir_fd* parameter.
341+
Added the *dir_fd* parameter.
342342

343343
.. versionchanged:: 3.12
344344
Added the *onexc* parameter, deprecated *onerror*.

_sources/whatsnew/3.12.rst.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,13 @@ os
778778
Both functions may be significantly faster on newer releases of
779779
Windows. (Contributed by Steve Dower in :gh:`99726`.)
780780

781+
* As of 3.12.4, :func:`os.mkdir` and :func:`os.makedirs` on Windows
782+
now support passing a *mode* value of ``0o700`` to apply access
783+
control to the new directory. This implicitly affects
784+
:func:`tempfile.mkdtemp` and is a mitigation for :cve:`2024-4030`.
785+
Other values for *mode* continue to be ignored.
786+
(Contributed by Steve Dower in :gh:`118486`.)
787+
781788
os.path
782789
-------
783790

@@ -925,6 +932,10 @@ tempfile
925932
*delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)
926933
* :func:`tempfile.mkdtemp` now always returns an absolute path, even if the
927934
argument provided to the *dir* parameter is a relative path.
935+
* As of 3.12.4 on Windows, the default mode ``0o700`` used by
936+
:func:`tempfile.mkdtemp` now limits access to the new directory due to
937+
changes to :func:`os.mkdir`. This is a mitigation for :cve:`2024-4030`.
938+
(Contributed by Steve Dower in :gh:`118486`.)
928939

929940
threading
930941
---------

about.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<script type="text/javascript" src="_static/menu.js"></script>
4747
<script type="text/javascript" src="_static/search-focus.js"></script>
4848
<script type="text/javascript" src="_static/themetoggle.js"></script>
49-
5049
<meta name="readthedocs-addons-api-version" content="1">
5150
<script type="text/javascript">
5251
function onSwitch(event) {
@@ -402,7 +401,7 @@ <h3>瀏覽</h3>
402401
<a href="https://www.python.org/psf/donations/">Please donate.</a>
403402
<br />
404403
<br />
405-
最後更新於 May 09, 2024 (08:37 UTC)。
404+
最後更新於 May 16, 2024 (07:44 UTC)。
406405

407406
<a href="/bugs.html">Found a bug</a>?
408407

bugs.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<script type="text/javascript" src="_static/menu.js"></script>
4747
<script type="text/javascript" src="_static/search-focus.js"></script>
4848
<script type="text/javascript" src="_static/themetoggle.js"></script>
49-
5049
<meta name="readthedocs-addons-api-version" content="1">
5150
<script type="text/javascript">
5251
function onSwitch(event) {
@@ -313,7 +312,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
313312
</section>
314313
<section id="getting-started-contributing-to-python-yourself">
315314
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
316-
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
315+
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
317316
</section>
318317
</section>
319318

@@ -441,7 +440,7 @@ <h3>瀏覽</h3>
441440
<a href="https://www.python.org/psf/donations/">Please donate.</a>
442441
<br />
443442
<br />
444-
最後更新於 May 09, 2024 (08:37 UTC)。
443+
最後更新於 May 16, 2024 (07:44 UTC)。
445444

446445
<a href="/bugs.html">Found a bug</a>?
447446

c-api/abstract.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<script type="text/javascript" src="../_static/menu.js"></script>
4747
<script type="text/javascript" src="../_static/search-focus.js"></script>
4848
<script type="text/javascript" src="../_static/themetoggle.js"></script>
49-
5049
<meta name="readthedocs-addons-api-version" content="1">
5150
<script type="text/javascript">
5251
function onSwitch(event) {
@@ -412,7 +411,7 @@ <h3>瀏覽</h3>
412411
<a href="https://www.python.org/psf/donations/">Please donate.</a>
413412
<br />
414413
<br />
415-
最後更新於 May 09, 2024 (08:37 UTC)。
414+
最後更新於 May 16, 2024 (07:44 UTC)。
416415

417416
<a href="/bugs.html">Found a bug</a>?
418417

c-api/allocation.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<script type="text/javascript" src="../_static/menu.js"></script>
4747
<script type="text/javascript" src="../_static/search-focus.js"></script>
4848
<script type="text/javascript" src="../_static/themetoggle.js"></script>
49-
5049
<meta name="readthedocs-addons-api-version" content="1">
5150
<script type="text/javascript">
5251
function onSwitch(event) {
@@ -426,7 +425,7 @@ <h3>瀏覽</h3>
426425
<a href="https://www.python.org/psf/donations/">Please donate.</a>
427426
<br />
428427
<br />
429-
最後更新於 May 09, 2024 (08:37 UTC)。
428+
最後更新於 May 16, 2024 (07:44 UTC)。
430429

431430
<a href="/bugs.html">Found a bug</a>?
432431

c-api/apiabiversion.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<script type="text/javascript" src="../_static/menu.js"></script>
4747
<script type="text/javascript" src="../_static/search-focus.js"></script>
4848
<script type="text/javascript" src="../_static/themetoggle.js"></script>
49-
5049
<meta name="readthedocs-addons-api-version" content="1">
5150
<script type="text/javascript">
5251
function onSwitch(event) {
@@ -458,7 +457,7 @@ <h3>瀏覽</h3>
458457
<a href="https://www.python.org/psf/donations/">Please donate.</a>
459458
<br />
460459
<br />
461-
最後更新於 May 09, 2024 (08:37 UTC)。
460+
最後更新於 May 16, 2024 (07:44 UTC)。
462461

463462
<a href="/bugs.html">Found a bug</a>?
464463

c-api/arg.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<script type="text/javascript" src="../_static/menu.js"></script>
4747
<script type="text/javascript" src="../_static/search-focus.js"></script>
4848
<script type="text/javascript" src="../_static/themetoggle.js"></script>
49-
5049
<meta name="readthedocs-addons-api-version" content="1">
5150
<script type="text/javascript">
5251
function onSwitch(event) {
@@ -969,7 +968,7 @@ <h3>瀏覽</h3>
969968
<a href="https://www.python.org/psf/donations/">Please donate.</a>
970969
<br />
971970
<br />
972-
最後更新於 May 09, 2024 (08:37 UTC)。
971+
最後更新於 May 16, 2024 (07:44 UTC)。
973972

974973
<a href="/bugs.html">Found a bug</a>?
975974

0 commit comments

Comments
 (0)