Skip to content

Commit 43234de

Browse files
committed
Merge remote-tracking branch 'origin/main' into reverse-getopt-optparse-deprecations
2 parents e474e77 + f032f6b commit 43234de

File tree

77 files changed

+1055
-601
lines changed

Some content is hidden

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

77 files changed

+1055
-601
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ Objects/exceptions.c @iritkatriel
8888
**/sha* @gpshead @tiran
8989
Modules/md5* @gpshead @tiran
9090
**/*blake* @gpshead @tiran
91-
Modules/_blake2/** @gpshead @tiran
9291
Modules/_hacl/** @gpshead
9392

9493
# logging

.github/workflows/jit.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ concurrency:
2828
jobs:
2929
interpreter:
3030
name: Interpreter (Debug)
31-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-22.04
3232
timeout-minutes: 90
3333
steps:
3434
- uses: actions/checkout@v4
@@ -85,19 +85,19 @@ jobs:
8585
compiler: clang
8686
- target: x86_64-unknown-linux-gnu/gcc
8787
architecture: x86_64
88-
runner: ubuntu-latest
88+
runner: ubuntu-22.04
8989
compiler: gcc
9090
- target: x86_64-unknown-linux-gnu/clang
9191
architecture: x86_64
92-
runner: ubuntu-latest
92+
runner: ubuntu-22.04
9393
compiler: clang
9494
- target: aarch64-unknown-linux-gnu/gcc
9595
architecture: aarch64
96-
runner: ubuntu-latest
96+
runner: ubuntu-22.04
9797
compiler: gcc
9898
- target: aarch64-unknown-linux-gnu/clang
9999
architecture: aarch64
100-
runner: ubuntu-latest
100+
runner: ubuntu-22.04
101101
compiler: clang
102102
env:
103103
CC: ${{ matrix.compiler }}
@@ -169,7 +169,7 @@ jobs:
169169
jit-with-disabled-gil:
170170
name: Free-Threaded (Debug)
171171
needs: interpreter
172-
runs-on: ubuntu-latest
172+
runs-on: ubuntu-22.04
173173
strategy:
174174
matrix:
175175
llvm:

Doc/c-api/conversion.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The following functions provide locale-independent string to number conversions.
105105
106106
If ``s`` represents a value that is too large to store in a float
107107
(for example, ``"1e500"`` is such a string on many platforms) then
108-
if ``overflow_exception`` is ``NULL`` return ``Py_HUGE_VAL`` (with
108+
if ``overflow_exception`` is ``NULL`` return ``Py_INFINITY`` (with
109109
an appropriate sign) and don't set any exception. Otherwise,
110110
``overflow_exception`` must point to a Python exception object;
111111
raise that exception and return ``-1.0``. In both cases, set

Doc/deprecations/pending-removal-in-3.14.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Pending removal in Python 3.14
8585
:meth:`~pathlib.PurePath.relative_to`: passing additional arguments is
8686
deprecated.
8787

88-
* :mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader`
88+
* :mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:!pkgutil.get_loader`
8989
now raise :exc:`DeprecationWarning`;
9090
use :func:`importlib.util.find_spec` instead.
9191
(Contributed by Nikita Sobolev in :gh:`97850`.)

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ iterations of the loop.
16471647

16481648
.. versionadded:: 3.13
16491649

1650-
.. opcode:: FORMAT_SPEC
1650+
.. opcode:: FORMAT_WITH_SPEC
16511651

16521652
Formats the given value with the given format spec::
16531653

Doc/library/enum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ using function-call syntax::
4444
... BLUE = 3
4545

4646
>>> # functional syntax
47-
>>> Color = Enum('Color', ['RED', 'GREEN', 'BLUE'])
47+
>>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])
4848

4949
Even though we can use :keyword:`class` syntax to create Enums, Enums
5050
are not normal Python classes. See

Doc/library/math.rst

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,92 @@ The following functions are provided by this module. Except when explicitly
2626
noted otherwise, all return values are floats.
2727

2828

29+
==================================================== ============================================
30+
**Number-theoretic and representation functions**
31+
--------------------------------------------------------------------------------------------------
32+
:func:`ceil(x) <ceil>` Ceiling of *x*, the smallest integer greater than or equal to *x*
33+
:func:`comb(n, k) <comb>` Number of ways to choose *k* items from *n* items without repetition and without order
34+
:func:`copysign(x, y) <copysign>` Magnitude (absolute value) of *x* with the sign of *y*
35+
:func:`fabs(x) <fabs>` Absolute value of *x*
36+
:func:`factorial(n) <factorial>` *n* factorial
37+
:func:`floor (x) <floor>` Floor of *x*, the largest integer less than or equal to *x*
38+
:func:`fma(x, y, z) <fma>` Fused multiply-add operation: ``(x * y) + z``
39+
:func:`fmod(x, y) <fmod>` Remainder of division ``x / y``
40+
:func:`frexp(x) <frexp>` Mantissa and exponent of *x*
41+
:func:`fsum(iterable) <fsum>` Sum of values in the input *iterable*
42+
:func:`gcd(*integers) <gcd>` Greatest common divisor of the integer arguments
43+
:func:`isclose(a, b, rel_tol, abs_tol) <isclose>` Check if the values *a* and *b* are close to each other
44+
:func:`isfinite(x) <isfinite>` Check if *x* is neither an infinity nor a NaN
45+
:func:`isinf(x) <isinf>` Check if *x* is a positive or negative infinity
46+
:func:`isnan(x) <isnan>` Check if *x* is a NaN (not a number)
47+
:func:`isqrt(n) <isqrt>` Integer square root of a nonnegative integer *n*
48+
:func:`lcm(*integers) <lcm>` Least common multiple of the integer arguments
49+
:func:`ldexp(x, i) <ldexp>` ``x * (2**i)``, inverse of function :func:`frexp`
50+
:func:`modf(x) <modf>` Fractional and integer parts of *x*
51+
:func:`nextafter(x, y, steps) <nextafter>` Floating-point value *steps* steps after *x* towards *y*
52+
:func:`perm(n, k) <perm>` Number of ways to choose *k* items from *n* items without repetition and with order
53+
:func:`prod(iterable, start) <prod>` Product of elements in the input *iterable* with a *start* value
54+
:func:`remainder(x, y) <remainder>` Remainder of *x* with respect to *y*
55+
:func:`sumprod(p, q) <sumprod>` Sum of products from two iterables *p* and *q*
56+
:func:`trunc(x) <trunc>` Integer part of *x*
57+
:func:`ulp(x) <ulp>` Value of the least significant bit of *x*
58+
59+
**Power and logarithmic functions**
60+
--------------------------------------------------------------------------------------------------
61+
:func:`cbrt(x) <cbrt>` Cube root of *x*
62+
:func:`exp(x) <exp>` *e* raised to the power *x*
63+
:func:`exp2(x) <exp2>` *2* raised to the power *x*
64+
:func:`expm1(x) <expm1>` *e* raised to the power *x*, minus 1
65+
:func:`log(x, base) <log>` Logarithm of *x* to the given base (*e* by default)
66+
:func:`log1p(x) <log1p>` Natural logarithm of *1+x* (base *e*)
67+
:func:`log2(x) <log2>` Base-2 logarithm of *x*
68+
:func:`log10(x) <log10>` Base-10 logarithm of *x*
69+
:func:`pow(x, y) <math.pow>` *x* raised to the power *y*
70+
:func:`sqrt(x) <sqrt>` Square root of *x*
71+
72+
**Trigonometric functions**
73+
--------------------------------------------------------------------------------------------------
74+
:func:`acos(x) <acos>` Arc cosine of *x*
75+
:func:`asin(x) <asin>` Arc sine of *x*
76+
:func:`atan(x) <atan>` Arc tangent of *x*
77+
:func:`atan2(y, x) <atan2>` ``atan(y / x)``
78+
:func:`cos(x) <cos>` Cosine of *x*
79+
:func:`dist(p, q) <dist>` Euclidean distance between two points *p* and *q* given as an iterable of coordinates
80+
:func:`hypot(*coordinates) <hypot>` Euclidean norm of an iterable of coordinates
81+
:func:`sin(x) <sin>` Sine of *x*
82+
:func:`tan(x) <tan>` Tangent of *x*
83+
84+
**Angular conversion**
85+
--------------------------------------------------------------------------------------------------
86+
:func:`degrees(x) <degrees>` Convert angle *x* from radians to degrees
87+
:func:`radians(x) <radians>` Convert angle *x* from degrees to radians
88+
89+
**Hyperbolic functions**
90+
--------------------------------------------------------------------------------------------------
91+
:func:`acosh(x) <acosh>` Inverse hyperbolic cosine of *x*
92+
:func:`asinh(x) <asinh>` Inverse hyperbolic sine of *x*
93+
:func:`atanh(x) <atanh>` Inverse hyperbolic tangent of *x*
94+
:func:`cosh(x) <cosh>` Hyperbolic cosine of *x*
95+
:func:`sinh(x) <sinh>` Hyperbolic sine of *x*
96+
:func:`tanh(x) <tanh>` Hyperbolic tangent of *x*
97+
98+
**Special functions**
99+
--------------------------------------------------------------------------------------------------
100+
:func:`erf(x) <erf>` `Error function <https://en.wikipedia.org/wiki/Error_function>`_ at *x*
101+
:func:`erfc(x) <erfc>` `Complementary error function <https://en.wikipedia.org/wiki/Error_function>`_ at *x*
102+
:func:`gamma(x) <gamma>` `Gamma function <https://en.wikipedia.org/wiki/Gamma_function>`_ at *x*
103+
:func:`lgamma(x) <lgamma>` Natural logarithm of the absolute value of the `Gamma function <https://en.wikipedia.org/wiki/Gamma_function>`_ at *x*
104+
105+
**Constants**
106+
--------------------------------------------------------------------------------------------------
107+
:data:`pi` *π* = 3.141592...
108+
:data:`e` *e* = 2.718281...
109+
:data:`tau` *τ* = 2\ *π* = 6.283185...
110+
:data:`inf` Positive infinity
111+
:data:`nan` "Not a number" (NaN)
112+
==================================================== ============================================
113+
114+
29115
Number-theoretic and representation functions
30116
---------------------------------------------
31117

@@ -447,11 +533,11 @@ Power and logarithmic functions
447533

448534
.. function:: pow(x, y)
449535

450-
Return ``x`` raised to the power ``y``. Exceptional cases follow
536+
Return *x* raised to the power *y*. Exceptional cases follow
451537
the IEEE 754 standard as far as possible. In particular,
452538
``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even
453-
when ``x`` is a zero or a NaN. If both ``x`` and ``y`` are finite,
454-
``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
539+
when *x* is a zero or a NaN. If both *x* and *y* are finite,
540+
*x* is negative, and *y* is not an integer then ``pow(x, y)``
455541
is undefined, and raises :exc:`ValueError`.
456542

457543
Unlike the built-in ``**`` operator, :func:`math.pow` converts both

Doc/library/pathlib.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,35 @@ Reading directories
12891289
raised.
12901290

12911291

1292+
.. method:: Path.scandir()
1293+
1294+
When the path points to a directory, return an iterator of
1295+
:class:`os.DirEntry` objects corresponding to entries in the directory. The
1296+
returned iterator supports the :term:`context manager` protocol. It is
1297+
implemented using :func:`os.scandir` and gives the same guarantees.
1298+
1299+
Using :meth:`~Path.scandir` instead of :meth:`~Path.iterdir` can
1300+
significantly increase the performance of code that also needs file type or
1301+
file attribute information, because :class:`os.DirEntry` objects expose
1302+
this information if the operating system provides it when scanning a
1303+
directory.
1304+
1305+
The following example displays the names of subdirectories. The
1306+
``entry.is_dir()`` check will generally not make an additional system call::
1307+
1308+
>>> p = Path('docs')
1309+
>>> with p.scandir() as entries:
1310+
... for entry in entries:
1311+
... if entry.is_dir():
1312+
... entry.name
1313+
...
1314+
'_templates'
1315+
'_build'
1316+
'_static'
1317+
1318+
.. versionadded:: 3.14
1319+
1320+
12921321
.. method:: Path.glob(pattern, *, case_sensitive=None, recurse_symlinks=False)
12931322

12941323
Glob the given relative *pattern* in the directory represented by this path,

Doc/library/pkgutil.rst

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,6 @@ support.
4949
this function to raise an exception (in line with :func:`os.path.isdir`
5050
behavior).
5151

52-
.. function:: find_loader(fullname)
53-
54-
Retrieve a module :term:`loader` for the given *fullname*.
55-
56-
This is a backwards compatibility wrapper around
57-
:func:`importlib.util.find_spec` that converts most failures to
58-
:exc:`ImportError` and only returns the loader rather than the full
59-
:class:`importlib.machinery.ModuleSpec`.
60-
61-
.. versionchanged:: 3.3
62-
Updated to be based directly on :mod:`importlib` rather than relying
63-
on the package internal :pep:`302` import emulation.
64-
65-
.. versionchanged:: 3.4
66-
Updated to be based on :pep:`451`
67-
68-
.. deprecated-removed:: 3.12 3.14
69-
Use :func:`importlib.util.find_spec` instead.
70-
7152

7253
.. function:: get_importer(path_item)
7354

@@ -84,27 +65,6 @@ support.
8465
on the package internal :pep:`302` import emulation.
8566

8667

87-
.. function:: get_loader(module_or_name)
88-
89-
Get a :term:`loader` object for *module_or_name*.
90-
91-
If the module or package is accessible via the normal import mechanism, a
92-
wrapper around the relevant part of that machinery is returned. Returns
93-
``None`` if the module cannot be found or imported. If the named module is
94-
not already imported, its containing package (if any) is imported, in order
95-
to establish the package ``__path__``.
96-
97-
.. versionchanged:: 3.3
98-
Updated to be based directly on :mod:`importlib` rather than relying
99-
on the package internal :pep:`302` import emulation.
100-
101-
.. versionchanged:: 3.4
102-
Updated to be based on :pep:`451`
103-
104-
.. deprecated-removed:: 3.12 3.14
105-
Use :func:`importlib.util.find_spec` instead.
106-
107-
10868
.. function:: iter_importers(fullname='')
10969

11070
Yield :term:`finder` objects for the given module name.

Doc/library/sqlite3.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,6 +2442,7 @@ Some useful URI tricks include:
24422442
>>> con.execute("CREATE TABLE readonly(data)")
24432443
Traceback (most recent call last):
24442444
OperationalError: attempt to write a readonly database
2445+
>>> con.close()
24452446

24462447
* Do not implicitly create a new database file if it does not already exist;
24472448
will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:

0 commit comments

Comments
 (0)