Skip to content

Commit cec0885

Browse files
committed
Merge remote-tracking branch 'upstream/main' into move-magic-number
2 parents ef89747 + 490e0ad commit cec0885

File tree

75 files changed

+2674
-1208
lines changed

Some content is hidden

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

75 files changed

+2674
-1208
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ Doc/c-api/stable.rst @encukou
214214
**/*idlelib* @terryjreedy
215215
/Doc/library/idle.rst @terryjreedy
216216

217+
**/*annotationlib* @JelleZijlstra
217218
**/*typing* @JelleZijlstra @AlexWaygood
218219

219220
**/*ftplib @giampaolo

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ jobs:
348348
with:
349349
save: false
350350
- name: Configure CPython
351-
run: ./configure --config-cache --enable-slower-safety --with-pydebug --with-openssl=$OPENSSL_DIR
351+
run: ./configure CFLAGS="-fdiagnostics-format=json" --config-cache --enable-slower-safety --with-pydebug --with-openssl=$OPENSSL_DIR
352352
- name: Build CPython
353353
run: make -j4
354354
- name: Display build info

.github/workflows/reusable-ubuntu.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,20 @@ jobs:
6767
working-directory: ${{ env.CPYTHON_BUILDDIR }}
6868
run: >-
6969
../cpython-ro-srcdir/configure
70+
CFLAGS="-fdiagnostics-format=json"
7071
--config-cache
7172
--with-pydebug
7273
--enable-slower-safety
7374
--with-openssl=$OPENSSL_DIR
7475
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
7576
- name: Build CPython out-of-tree
7677
working-directory: ${{ env.CPYTHON_BUILDDIR }}
77-
run: make -j4
78+
run: make -j4 &> compiler_output.txt
7879
- name: Display build info
7980
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8081
run: make pythoninfo
82+
- name: Check compiler warnings
83+
run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu
8184
- name: Remount sources writable for tests
8285
# some tests write to srcdir, lack of pyc files slows down testing
8386
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw

Doc/bugs.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@ Documentation bugs
1616
==================
1717

1818
If you find a bug in this documentation or would like to propose an improvement,
19-
please submit a bug report on the :ref:`tracker <using-the-tracker>`. If you
19+
please submit a bug report on the :ref:`issue tracker <using-the-tracker>`. If you
2020
have a suggestion on how to fix it, include that as well.
2121

2222
You can also open a discussion item on our
2323
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.
2424

2525
If you find a bug in the theme (HTML / CSS / JavaScript) of the
26-
documentation, please submit a bug report on the `python-doc-theme bug
26+
documentation, please submit a bug report on the `python-doc-theme issue
2727
tracker <https://github.com/python/python-docs-theme>`_.
2828

29-
If you're short on time, you can also email documentation bug reports to
30-
[email protected] (behavioral bugs can be sent to [email protected]).
31-
'docs@' is a mailing list run by volunteers; your request will be noticed,
32-
though it may take a while to be processed.
33-
3429
.. seealso::
3530

3631
`Documentation bugs`_

Doc/contents.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
installing/index.rst
1515
howto/index.rst
1616
faq/index.rst
17+
deprecations/index.rst
1718
glossary.rst
1819

1920
about.rst

Doc/deprecations/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Deprecations
2+
============
3+
4+
.. include:: pending-removal-in-3.14.rst
5+
6+
.. include:: pending-removal-in-3.15.rst
7+
8+
.. include:: pending-removal-in-3.16.rst
9+
10+
.. include:: pending-removal-in-future.rst
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Pending Removal in Python 3.16
22
------------------------------
33

4-
* :class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
4+
* :mod:`array`:
5+
:class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
56
use the ``'w'`` type instead (``Py_UCS4``).
7+
8+
* :mod:`symtable`:
9+
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest.
10+
(Contributed by Bénédikt Tran in :gh:`119698`.)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ although there is currently no date scheduled for their removal.
3434
:class:`complex`: these methods will be required to return an instance of
3535
:class:`complex`.
3636
* Delegation of ``int()`` to ``__trunc__()`` method.
37+
* Passing a complex number as the *real* or *imag* argument in the
38+
:func:`complex` constructor is now deprecated; it should only be passed
39+
as a single positional argument.
40+
(Contributed by Serhiy Storchaka in :gh:`109218`.)
3741

3842
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
3943
deprecated and replaced by :data:`calendar.JANUARY` and

Doc/library/ast.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ Literals
316316
args=[
317317
Name(id='a', ctx=Load())]),
318318
conversion=-1,
319-
format_spec=Constant(value='.3'))]))
319+
format_spec=JoinedStr(
320+
values=[
321+
Constant(value='.3')]))]))
320322

321323

322324
.. class:: List(elts, ctx)

Doc/library/mimetypes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,3 +295,13 @@ than one MIME-type database; it provides an interface similar to the one of the
295295
types, else to the list of non-standard types.
296296

297297
.. versionadded:: 3.2
298+
299+
300+
.. method:: MimeTypes.add_type(type, ext, strict=True)
301+
302+
Add a mapping from the MIME type *type* to the extension *ext*. When the
303+
extension is already known, the new type will replace the old one. When the type
304+
is already known the extension will be added to the list of known extensions.
305+
306+
When *strict* is ``True`` (the default), the mapping will be added to the
307+
official MIME types, otherwise to the non-standard ones.

Doc/library/pathlib.rst

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,39 +1864,54 @@ Corresponding tools
18641864
Below is a table mapping various :mod:`os` functions to their corresponding
18651865
:class:`PurePath`/:class:`Path` equivalent.
18661866

1867-
==================================== ==============================
1868-
:mod:`os` and :mod:`os.path` :mod:`pathlib`
1869-
==================================== ==============================
1870-
:func:`os.path.abspath` :meth:`Path.absolute`
1871-
:func:`os.path.realpath` :meth:`Path.resolve`
1872-
:func:`os.chmod` :meth:`Path.chmod`
1873-
:func:`os.mkdir` :meth:`Path.mkdir`
1874-
:func:`os.makedirs` :meth:`Path.mkdir`
1875-
:func:`os.rename` :meth:`Path.rename`
1876-
:func:`os.replace` :meth:`Path.replace`
1877-
:func:`os.rmdir` :meth:`Path.rmdir`
1878-
:func:`os.remove`, :func:`os.unlink` :meth:`Path.unlink`
1879-
:func:`os.getcwd` :func:`Path.cwd`
1880-
:func:`os.path.exists` :meth:`Path.exists`
1881-
:func:`os.path.expanduser` :meth:`Path.expanduser` and
1882-
:meth:`Path.home`
1883-
:func:`os.listdir` :meth:`Path.iterdir`
1884-
:func:`os.walk` :meth:`Path.walk`
1885-
:func:`os.path.isdir` :meth:`Path.is_dir`
1886-
:func:`os.path.isfile` :meth:`Path.is_file`
1887-
:func:`os.path.islink` :meth:`Path.is_symlink`
1888-
:func:`os.link` :meth:`Path.hardlink_to`
1889-
:func:`os.symlink` :meth:`Path.symlink_to`
1890-
:func:`os.readlink` :meth:`Path.readlink`
1891-
:func:`os.path.relpath` :meth:`PurePath.relative_to`
1892-
:func:`os.stat` :meth:`Path.stat`,
1893-
:meth:`Path.owner`,
1894-
:meth:`Path.group`
1895-
:func:`os.path.isabs` :meth:`PurePath.is_absolute`
1896-
:func:`os.path.join` :func:`PurePath.joinpath`
1897-
:func:`os.path.basename` :attr:`PurePath.name`
1898-
:func:`os.path.dirname` :attr:`PurePath.parent`
1899-
:func:`os.path.samefile` :meth:`Path.samefile`
1900-
:func:`os.path.splitext` :attr:`PurePath.stem` and
1901-
:attr:`PurePath.suffix`
1902-
==================================== ==============================
1867+
===================================== ==============================================
1868+
:mod:`os` and :mod:`os.path` :mod:`pathlib`
1869+
===================================== ==============================================
1870+
:func:`os.path.dirname` :attr:`PurePath.parent`
1871+
:func:`os.path.basename` :attr:`PurePath.name`
1872+
:func:`os.path.splitext` :attr:`PurePath.stem`, :attr:`PurePath.suffix`
1873+
:func:`os.path.join` :meth:`PurePath.joinpath`
1874+
:func:`os.path.isabs` :meth:`PurePath.is_absolute`
1875+
:func:`os.path.relpath` :meth:`PurePath.relative_to` [1]_
1876+
:func:`os.path.expanduser` :meth:`Path.expanduser` [2]_
1877+
:func:`os.path.realpath` :meth:`Path.resolve`
1878+
:func:`os.path.abspath` :meth:`Path.absolute` [3]_
1879+
:func:`os.path.exists` :meth:`Path.exists`
1880+
:func:`os.path.isfile` :meth:`Path.is_file`
1881+
:func:`os.path.isdir` :meth:`Path.is_dir`
1882+
:func:`os.path.islink` :meth:`Path.is_symlink`
1883+
:func:`os.path.isjunction` :meth:`Path.is_junction`
1884+
:func:`os.path.ismount` :meth:`Path.is_mount`
1885+
:func:`os.path.samefile` :meth:`Path.samefile`
1886+
:func:`os.getcwd` :meth:`Path.cwd`
1887+
:func:`os.stat` :meth:`Path.stat`
1888+
:func:`os.lstat` :meth:`Path.lstat`
1889+
:func:`os.listdir` :meth:`Path.iterdir`
1890+
:func:`os.walk` :meth:`Path.walk` [4]_
1891+
:func:`os.mkdir`, :func:`os.makedirs` :meth:`Path.mkdir`
1892+
:func:`os.link` :meth:`Path.hardlink_to`
1893+
:func:`os.symlink` :meth:`Path.symlink_to`
1894+
:func:`os.readlink` :meth:`Path.readlink`
1895+
:func:`os.rename` :meth:`Path.rename`
1896+
:func:`os.replace` :meth:`Path.replace`
1897+
:func:`os.remove`, :func:`os.unlink` :meth:`Path.unlink`
1898+
:func:`os.rmdir` :meth:`Path.rmdir`
1899+
:func:`os.chmod` :meth:`Path.chmod`
1900+
:func:`os.lchmod` :meth:`Path.lchmod`
1901+
===================================== ==============================================
1902+
1903+
.. rubric:: Footnotes
1904+
1905+
.. [1] :func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths
1906+
absolute and remove "``..``" parts, whereas :meth:`PurePath.relative_to`
1907+
is a lexical operation that raises :exc:`ValueError` when its inputs'
1908+
anchors differ (e.g. if one path is absolute and the other relative.)
1909+
.. [2] :func:`os.path.expanduser` returns the path unchanged if the home
1910+
directory can't be resolved, whereas :meth:`Path.expanduser` raises
1911+
:exc:`RuntimeError`.
1912+
.. [3] :func:`os.path.abspath` removes "``..``" components without resolving
1913+
symlinks, which may change the meaning of the path, whereas
1914+
:meth:`Path.absolute` leaves any "``..``" components in the path.
1915+
.. [4] :func:`os.walk` always follows symlinks when categorizing paths into
1916+
*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all
1917+
symlinks into *filenames* when *follow_symlinks* is false (the default.)

Doc/library/shutil.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,9 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
706706

707707
The keyword-only *filter* argument is passed to the underlying unpacking
708708
function. For zip files, *filter* is not accepted.
709-
For tar files, it is recommended to set it to ``'data'``,
710-
unless using features specific to tar and UNIX-like filesystems.
709+
For tar files, it is recommended to use ``'data'`` (default since Python
710+
3.14), unless using features specific to tar and UNIX-like filesystems.
711711
(See :ref:`tarfile-extraction-filter` for details.)
712-
The ``'data'`` filter will become the default for tar files
713-
in Python 3.14.
714712

715713
.. audit-event:: shutil.unpack_archive filename,extract_dir,format shutil.unpack_archive
716714

@@ -721,6 +719,12 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
721719
the *extract_dir* argument, e.g. members that have absolute filenames
722720
starting with "/" or filenames with two dots "..".
723721

722+
Since Python 3.14, the defaults for both built-in formats (zip and tar
723+
files) will prevent the most dangerous of such security issues,
724+
but will not prevent *all* unintended behavior.
725+
Read the :ref:`tarfile-further-verification`
726+
section for tar-specific details.
727+
724728
.. versionchanged:: 3.7
725729
Accepts a :term:`path-like object` for *filename* and *extract_dir*.
726730

0 commit comments

Comments
 (0)