Skip to content

Commit ab7ebf3

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-150001
2 parents b2c5aca + ba0aca3 commit ab7ebf3

38 files changed

Lines changed: 508 additions & 94 deletions

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,16 @@ jobs:
206206
strategy:
207207
fail-fast: false
208208
matrix:
209-
# macos-26 is Apple Silicon, macos-15-intel is Intel.
210-
# macos-15-intel only runs tests against the GIL-enabled CPython.
209+
# macos-26 is Apple Silicon, macos-26-intel is Intel.
210+
# macos-26-intel only runs tests against the GIL-enabled CPython.
211211
os:
212212
- macos-26
213-
- macos-15-intel
213+
- macos-26-intel
214214
free-threading:
215215
- false
216216
- true
217217
exclude:
218-
- os: macos-15-intel
218+
- os: macos-26-intel
219219
free-threading: true
220220
uses: ./.github/workflows/reusable-macos.yml
221221
with:

.github/workflows/reusable-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ jobs:
5454
--prefix=/opt/python-dev \
5555
--with-openssl="$(brew --prefix openssl@3.5)"
5656
- name: Build CPython
57-
if : ${{ inputs.free-threading || inputs.os != 'macos-15-intel' }}
57+
if : ${{ inputs.free-threading || inputs.os != 'macos-26-intel' }}
5858
run: gmake -j8
5959
- name: Build CPython for compiler warning check
60-
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
60+
if : ${{ !inputs.free-threading && inputs.os == 'macos-26-intel' }}
6161
run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt
6262
- name: Display build info
6363
run: make pythoninfo
6464
- name: Check compiler warnings
65-
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
65+
if : ${{ !inputs.free-threading && inputs.os == 'macos-26-intel' }}
6666
run: >-
6767
python3 Tools/build/check_warnings.py
6868
--compiler-output-file-path=compiler_output_macos.txt

Doc/deprecations/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Deprecations
1313

1414
.. include:: pending-removal-in-3.20.rst
1515

16+
.. include:: pending-removal-in-3.21.rst
17+
1618
.. include:: pending-removal-in-future.rst
1719

1820
.. include:: soft-deprecations.rst
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Pending removal in Python 3.21
2+
------------------------------
3+
4+
* :mod:`ast`:
5+
6+
* Classes ``slice``, ``Index``, ``ExtSlice``, ``Suite``, ``Param``,
7+
``AugLoad`` and ``AugStore``, will be removed in Python 3.21. These types
8+
are not generated by the parser or accepted by the code generator.
9+
* The ``dims`` property of ``ast.Tuple`` will be removed in Python 3.21. Use
10+
the ``ast.Tuple.elts`` property instead.

Doc/library/dataclasses.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ Module contents
418418
:func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass
419419
instance.
420420

421-
.. function:: make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False, module=None, decorator=dataclass)
421+
.. function:: make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False, module=None, qualname=None, decorator=dataclass)
422422

423423
Creates a new dataclass with name *cls_name*, fields as defined
424424
in *fields*, base classes as given in *bases*, and initialized
@@ -434,6 +434,9 @@ Module contents
434434
of the dataclass is set to that value.
435435
By default, it is set to the module name of the caller.
436436

437+
If *qualname* is defined, the :attr:`~type.__qualname__` attribute of the dataclass
438+
is set to that value. By default, it is set to the value passed to *cls_name*.
439+
437440
The *decorator* parameter is a callable that will be used to create the dataclass.
438441
It should take the class object as a first argument and the same keyword arguments
439442
as :deco:`dataclass`. By default, the :deco:`dataclass`
@@ -464,6 +467,8 @@ Module contents
464467

465468
.. versionadded:: 3.14
466469
Added the *decorator* parameter.
470+
.. versionadded:: next
471+
Added the *qualname* parameter.
467472

468473
.. function:: replace(obj, /, **changes)
469474

Doc/library/inspect.rst

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,24 +424,63 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
424424

425425
Return ``True`` if the object is a bound method written in Python.
426426

427+
.. note::
427428

428-
.. function:: ispackage(object)
429+
For example, given this class::
429430

430-
Return ``True`` if the object is a :term:`package`.
431+
>>> class Greeter:
432+
... def say_hello(self):
433+
... print('hello!')
431434

432-
.. versionadded:: 3.14
435+
A bound method (also known as an *instance method*) is created when
436+
accessing ``say_hello`` (a :term:`function` defined in the
437+
``Greeter`` namespace) through an instance of the ``Greeter`` class::
438+
439+
>>> instance = Greeter()
440+
441+
>>> instance.say_hello
442+
<bound method Greeter.say_hello of <__main__.Greeter object ...>>
443+
>>> ismethod(instance.say_hello)
444+
True
445+
>>> isfunction(instance.say_hello)
446+
False
447+
448+
Accessing ``say_hello`` through the ``Greeter`` class will return the
449+
function itself. For this function, :func:`ismethod` will return
450+
``False``, but :func:`isfunction` will return ``True``::
451+
452+
>>> Greeter.say_hello
453+
<function Greeter.say_hello at 0x7f7503854a90>
454+
>>> ismethod(Greeter.say_hello)
455+
False
456+
>>> isfunction(Greeter.say_hello)
457+
True
458+
459+
See :ref:`typesmethods` for details.
433460

434461

435462
.. function:: isfunction(object)
436463

437464
Return ``True`` if the object is a Python function, which includes functions
438465
created by a :term:`lambda` expression.
439466

467+
See the note for :func:`~inspect.ismethod` for an example.
468+
469+
470+
.. function:: ispackage(object)
471+
472+
Return ``True`` if the object is a :term:`package`.
473+
474+
.. versionadded:: 3.14
475+
440476

441477
.. function:: isgeneratorfunction(object)
442478

443479
Return ``True`` if the object is a Python generator function.
444480

481+
It also returns ``True`` for bound methods created from Python generator functions
482+
(see :ref:`typesmethods` for more information).
483+
445484
.. versionchanged:: 3.8
446485
Functions wrapped in :func:`functools.partial` now return ``True`` if the
447486
wrapped function is a Python generator function.

Doc/library/os.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2549,7 +2549,8 @@ features:
25492549
Windows now handles a *mode* of ``0o700``.
25502550

25512551

2552-
.. function:: makedirs(name, mode=0o777, exist_ok=False)
2552+
.. function:: makedirs(name, mode=0o777, exist_ok=False, *, \
2553+
parent_mode=None)
25532554

25542555
.. index::
25552556
single: directory; creating
@@ -2567,6 +2568,12 @@ features:
25672568
If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is
25682569
raised if the target directory already exists.
25692570

2571+
If *parent_mode* is not ``None``, it is used as the mode for any
2572+
newly-created, intermediate-level directories. Like *mode*, it is
2573+
combined with the process's umask value; see :ref:`the mkdir()
2574+
description <mkdir_modebits>`. Otherwise, intermediate directories are
2575+
created with the default mode, which is also subject to the umask.
2576+
25702577
.. note::
25712578

25722579
:func:`makedirs` will become confused if the path elements to create
@@ -2593,6 +2600,11 @@ features:
25932600
The *mode* argument no longer affects the file permission bits of
25942601
newly created intermediate-level directories.
25952602

2603+
.. versionadded:: 3.15
2604+
The *parent_mode* parameter. To match the behavior from Python 3.6 and
2605+
earlier (where *mode* was applied to all created directories), pass
2606+
``parent_mode=mode``.
2607+
25962608

25972609
.. function:: mkfifo(path, mode=0o666, *, dir_fd=None)
25982610

Doc/library/pathlib.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,8 @@ Creating files and directories
15181518
:meth:`~Path.write_bytes` methods are often used to create files.
15191519

15201520

1521-
.. method:: Path.mkdir(mode=0o777, parents=False, exist_ok=False)
1521+
.. method:: Path.mkdir(mode=0o777, parents=False, exist_ok=False, *, \
1522+
parent_mode=None)
15221523

15231524
Create a new directory at this given path. If *mode* is given, it is
15241525
combined with the process's ``umask`` value to determine the file mode
@@ -1529,6 +1530,12 @@ Creating files and directories
15291530
as needed; they are created with the default permissions without taking
15301531
*mode* into account (mimicking the POSIX ``mkdir -p`` command).
15311532

1533+
If *parent_mode* is not ``None``, it is used as the mode for any
1534+
newly-created, intermediate-level directories when *parents* is true.
1535+
Like *mode*, it is combined with the process's ``umask`` value.
1536+
Otherwise, intermediate directories are created with the default
1537+
permissions (also subject to the umask).
1538+
15321539
If *parents* is false (the default), a missing parent raises
15331540
:exc:`FileNotFoundError`.
15341541

@@ -1542,6 +1549,9 @@ Creating files and directories
15421549
.. versionchanged:: 3.5
15431550
The *exist_ok* parameter was added.
15441551

1552+
.. versionadded:: 3.15
1553+
The *parent_mode* parameter.
1554+
15451555

15461556
.. method:: Path.symlink_to(target, target_is_directory=False)
15471557

Doc/library/shutil.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,8 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
749749

750750
Never extract archives from untrusted sources without prior inspection.
751751
It is possible that files are created outside of the path specified in
752-
the *extract_dir* argument, e.g. members that have absolute filenames
753-
starting with "/" or filenames with two dots "..".
752+
the *extract_dir* argument, for example, members that have absolute filenames
753+
or filenames with ".." components.
754754

755755
Since Python 3.14, the defaults for both built-in formats (zip and tar
756756
files) will prevent the most dangerous of such security issues,

Doc/library/stdtypes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,6 +2747,8 @@ expression support in the :mod:`re` module).
27472747
The *chars* argument is not a prefix or suffix; rather, all combinations of its
27482748
values are stripped.
27492749

2750+
Whitespace characters are defined by :meth:`str.isspace`.
2751+
27502752
For example:
27512753

27522754
.. doctest::

0 commit comments

Comments
 (0)