Skip to content

Commit 597fd69

Browse files
committed
Merge remote-tracking branch 'origin/main' into cases-array
2 parents 11f6a58 + 57a5259 commit 597fd69

File tree

78 files changed

+1226
-487
lines changed

Some content is hidden

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

78 files changed

+1226
-487
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,8 @@ Lib/ast.py @isidentical
152152
/Mac/ @python/macos-team
153153
**/*osx_support* @python/macos-team
154154

155+
# pathlib
156+
**/*pathlib* @barneygale
157+
155158
# zipfile.Path
156159
**/*zipfile/*_path.py @jaraco

Doc/copyright.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Copyright
44

55
Python and this documentation is:
66

7-
Copyright © 2001-2022 Python Software Foundation. All rights reserved.
7+
Copyright © 2001-2023 Python Software Foundation. All rights reserved.
88

99
Copyright © 2000 BeOpen.com. All rights reserved.
1010

Doc/library/itertools.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ by combining :func:`map` and :func:`count` to form ``map(f, count())``.
3333
These tools and their built-in counterparts also work well with the high-speed
3434
functions in the :mod:`operator` module. For example, the multiplication
3535
operator can be mapped across two vectors to form an efficient dot-product:
36-
``sum(map(operator.mul, vector1, vector2))``.
36+
``sum(starmap(operator.mul, zip(vec1, vec2, strict=True)))``.
3737

3838

3939
**Infinite iterators:**
@@ -838,10 +838,6 @@ which incur interpreter overhead.
838838
"Returns the sequence elements n times"
839839
return chain.from_iterable(repeat(tuple(iterable), n))
840840

841-
def dotproduct(vec1, vec2):
842-
"Compute a sum of products."
843-
return sum(starmap(operator.mul, zip(vec1, vec2, strict=True)))
844-
845841
def convolve(signal, kernel):
846842
# See: https://betterexplained.com/articles/intuitive-convolution/
847843
# convolve(data, [0.25, 0.25, 0.25, 0.25]) --> Moving average (blur)
@@ -852,7 +848,7 @@ which incur interpreter overhead.
852848
window = collections.deque([0], maxlen=n) * n
853849
for x in chain(signal, repeat(0, n-1)):
854850
window.append(x)
855-
yield dotproduct(kernel, window)
851+
yield math.sumprod(kernel, window)
856852

857853
def polynomial_from_roots(roots):
858854
"""Compute a polynomial's coefficients from its roots.
@@ -1211,9 +1207,6 @@ which incur interpreter overhead.
12111207
>>> list(ncycles('abc', 3))
12121208
['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']
12131209

1214-
>>> dotproduct([1,2,3], [4,5,6])
1215-
32
1216-
12171210
>>> data = [20, 40, 24, 32, 20, 28, 16]
12181211
>>> list(convolve(data, [0.25, 0.25, 0.25, 0.25]))
12191212
[5.0, 15.0, 21.0, 29.0, 29.0, 26.0, 24.0, 16.0, 11.0, 4.0]

Doc/library/math.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,22 @@ Number-theoretic and representation functions
291291
.. versionadded:: 3.7
292292

293293

294+
.. function:: sumprod(p, q)
295+
296+
Return the sum of products of values from two iterables *p* and *q*.
297+
298+
Raises :exc:`ValueError` if the inputs do not have the same length.
299+
300+
Roughly equivalent to::
301+
302+
sum(itertools.starmap(operator.mul, zip(p, q, strict=true)))
303+
304+
For float and mixed int/float inputs, the intermediate products
305+
and sums are computed with extended precision.
306+
307+
.. versionadded:: 3.12
308+
309+
294310
.. function:: trunc(x)
295311

296312
Return *x* with the fractional part

Doc/library/os.path.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,17 +306,18 @@ the :mod:`glob` module.)
306306

307307
.. function:: join(path, *paths)
308308

309-
Join one or more path components intelligently. The return value is the
310-
concatenation of *path* and any members of *\*paths* with exactly one
311-
directory separator following each non-empty part except the last, meaning
312-
that the result will only end in a separator if the last part is empty. If
313-
a component is an absolute path, all previous components are thrown away
314-
and joining continues from the absolute path component.
315-
316-
On Windows, the drive letter is not reset when an absolute path component
317-
(e.g., ``r'\foo'``) is encountered. If a component contains a drive
318-
letter, all previous components are thrown away and the drive letter is
319-
reset. Note that since there is a current directory for each drive,
309+
Join one or more path segments intelligently. The return value is the
310+
concatenation of *path* and all members of *\*paths*, with exactly one
311+
directory separator following each non-empty part except the last. That is,
312+
if the last part is empty, the result will end in a separator. If
313+
a segment is an absolute path (which on Windows requires both a drive and a
314+
root), then all previous segments are ignored and joining continues from the
315+
absolute path segment.
316+
317+
On Windows, the drive is not reset when a rooted path segment (e.g.,
318+
``r'\foo'``) is encountered. If a segment is on a different drive or is an
319+
absolute path, all previous segments are ignored and the drive is reset. Note
320+
that since there is a current directory for each drive,
320321
``os.path.join("c:", "foo")`` represents a path relative to the current
321322
directory on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\foo`.
322323

Doc/library/os.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,6 +2467,8 @@ features:
24672467
will fail with an :exc:`OSError` subclass in a number of cases:
24682468

24692469
On Windows, if *dst* exists a :exc:`FileExistsError` is always raised.
2470+
The operation may fail if *src* and *dst* are on different filesystems. Use
2471+
:func:`shutil.move` to support moves to a different filesystem.
24702472

24712473
On Unix, if *src* is a file and *dst* is a directory or vice-versa, an
24722474
:exc:`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised

Doc/library/socket.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ Constants
436436
``TCP_FASTOPEN_CONNECT``, ``TCP_ULP``, ``TCP_MD5SIG_EXT``,
437437
``TCP_FASTOPEN_KEY``, ``TCP_FASTOPEN_NO_COOKIE``,
438438
``TCP_ZEROCOPY_RECEIVE``, ``TCP_INQ``, ``TCP_TX_DELAY``.
439+
Added ``IP_PKTINFO``.
439440

440441
.. data:: AF_CAN
441442
PF_CAN

Doc/library/typing.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,10 +2777,6 @@ Introspection helpers
27772777
.. versionchanged:: 3.9
27782778
Added ``include_extras`` parameter as part of :pep:`593`.
27792779

2780-
.. versionchanged:: 3.10
2781-
Calling ``get_type_hints()`` on a class no longer returns the annotations
2782-
of its base classes.
2783-
27842780
.. versionchanged:: 3.11
27852781
Previously, ``Optional[t]`` was added for function and method annotations
27862782
if a default value equal to ``None`` was set.

Doc/library/unittest.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,12 +1947,12 @@ Loading and running tests
19471947
.. attribute:: testNamePatterns
19481948

19491949
List of Unix shell-style wildcard test name patterns that test methods
1950-
have to match to be included in test suites (see ``-v`` option).
1950+
have to match to be included in test suites (see ``-k`` option).
19511951

19521952
If this attribute is not ``None`` (the default), all test methods to be
19531953
included in test suites must match one of the patterns in this list.
19541954
Note that matches are always performed using :meth:`fnmatch.fnmatchcase`,
1955-
so unlike patterns passed to the ``-v`` option, simple substring patterns
1955+
so unlike patterns passed to the ``-k`` option, simple substring patterns
19561956
will have to be converted using ``*`` wildcards.
19571957

19581958
This affects all the :meth:`loadTestsFrom\*` methods.

Doc/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
100100
analyze, test, perform and/or display publicly, prepare derivative works,
101101
distribute, and otherwise use Python |release| alone or in any derivative
102102
version, provided, however, that PSF's License Agreement and PSF's notice of
103-
copyright, i.e., "Copyright © 2001-2022 Python Software Foundation; All Rights
103+
copyright, i.e., "Copyright © 2001-2023 Python Software Foundation; All Rights
104104
Reserved" are retained in Python |release| alone or in any derivative version
105105
prepared by Licensee.
106106

0 commit comments

Comments
 (0)