Skip to content

Commit 1c0bfc0

Browse files
committed
Merge branch 'main' into docs/whatsnew/other-language-changes
2 parents f73396d + f3d7fae commit 1c0bfc0

Some content is hidden

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

50 files changed

+4883
-3927
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.12.8
3+
rev: v0.13.2
44
hooks:
5-
- id: ruff
5+
- id: ruff-check
66
name: Run Ruff (lint) on Doc/
77
args: [--exit-non-zero-on-fix]
88
files: ^Doc/
9-
- id: ruff
9+
- id: ruff-check
1010
name: Run Ruff (lint) on Lib/test/
1111
args: [--exit-non-zero-on-fix]
1212
files: ^Lib/test/
13-
- id: ruff
13+
- id: ruff-check
1414
name: Run Ruff (lint) on Tools/build/
1515
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
1616
files: ^Tools/build/
17-
- id: ruff
17+
- id: ruff-check
1818
name: Run Ruff (lint) on Tools/i18n/
1919
args: [--exit-non-zero-on-fix, --config=Tools/i18n/.ruff.toml]
2020
files: ^Tools/i18n/
21-
- id: ruff
21+
- id: ruff-check
2222
name: Run Ruff (lint) on Argument Clinic
2323
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
2424
files: ^Tools/clinic/|Lib/test/test_clinic.py
25-
- id: ruff
25+
- id: ruff-check
2626
name: Run Ruff (lint) on Tools/peg_generator/
2727
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
2828
files: ^Tools/peg_generator/
@@ -36,7 +36,7 @@ repos:
3636
files: ^Tools/build/check_warnings.py
3737

3838
- repo: https://github.com/psf/black-pre-commit-mirror
39-
rev: 25.1.0
39+
rev: 25.9.0
4040
hooks:
4141
- id: black
4242
name: Run Black on Tools/jit/
@@ -47,7 +47,6 @@ repos:
4747
hooks:
4848
- id: remove-tabs
4949
types: [python]
50-
exclude: ^Tools/c-analyzer/cpython/_parser.py
5150

5251
- repo: https://github.com/pre-commit/pre-commit-hooks
5352
rev: v6.0.0
@@ -68,7 +67,7 @@ repos:
6867
files: '^\.github/CODEOWNERS|\.(gram)$'
6968

7069
- repo: https://github.com/python-jsonschema/check-jsonschema
71-
rev: 0.33.2
70+
rev: 0.34.0
7271
hooks:
7372
- id: check-dependabot
7473
- id: check-github-workflows
@@ -80,7 +79,7 @@ repos:
8079
- id: actionlint
8180

8281
- repo: https://github.com/woodruffw/zizmor-pre-commit
83-
rev: v1.11.0
82+
rev: v1.14.1
8483
hooks:
8584
- id: zizmor
8685

Doc/c-api/init.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,9 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
13821382
This is not a replacement for :c:func:`PyModule_GetState()`, which
13831383
extensions should use to store interpreter-specific state information.
13841384
1385+
The returned dictionary is borrowed from the interpreter and is valid until
1386+
interpreter shutdown.
1387+
13851388
.. versionadded:: 3.8
13861389
13871390

Doc/data/refcounts.dat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ PyInterpreterState_Clear:PyInterpreterState*:interp::
11411141
PyInterpreterState_Delete:void:::
11421142
PyInterpreterState_Delete:PyInterpreterState*:interp::
11431143

1144+
PyInterpreterState_GetDict:PyObject*::0:
1145+
PyInterpreterState_GetDict:PyInterpreterState*:interp::
1146+
11441147
PyInterpreterState_GetID:int64_t:::
11451148
PyInterpreterState_GetID:PyInterpreterState*:interp::
11461149

Doc/library/enum.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ Data Types
315315
Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and
316316
any public methods defined on *self.__class__*::
317317

318+
>>> from enum import Enum
318319
>>> from datetime import date
319320
>>> class Weekday(Enum):
320321
... MONDAY = 1
@@ -341,7 +342,7 @@ Data Types
341342
A *staticmethod* that is used to determine the next value returned by
342343
:class:`auto`::
343344

344-
>>> from enum import auto
345+
>>> from enum import auto, Enum
345346
>>> class PowersOfThree(Enum):
346347
... @staticmethod
347348
... def _generate_next_value_(name, start, count, last_values):
@@ -373,7 +374,7 @@ Data Types
373374
A *classmethod* for looking up values not found in *cls*. By default it
374375
does nothing, but can be overridden to implement custom search behavior::
375376

376-
>>> from enum import StrEnum
377+
>>> from enum import auto, StrEnum
377378
>>> class Build(StrEnum):
378379
... DEBUG = auto()
379380
... OPTIMIZED = auto()
@@ -412,6 +413,7 @@ Data Types
412413
Returns the string used for *repr()* calls. By default, returns the
413414
*Enum* name, member name, and value, but can be overridden::
414415

416+
>>> from enum import auto, Enum
415417
>>> class OtherStyle(Enum):
416418
... ALTERNATE = auto()
417419
... OTHER = auto()
@@ -428,6 +430,7 @@ Data Types
428430
Returns the string used for *str()* calls. By default, returns the
429431
*Enum* name and member name, but can be overridden::
430432

433+
>>> from enum import auto, Enum
431434
>>> class OtherStyle(Enum):
432435
... ALTERNATE = auto()
433436
... OTHER = auto()
@@ -443,6 +446,7 @@ Data Types
443446
Returns the string used for *format()* and *f-string* calls. By default,
444447
returns :meth:`__str__` return value, but can be overridden::
445448

449+
>>> from enum import auto, Enum
446450
>>> class OtherStyle(Enum):
447451
... ALTERNATE = auto()
448452
... OTHER = auto()

Doc/library/mmap.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
212212
Writable :term:`bytes-like object` is now accepted.
213213

214214

215-
.. method:: flush()
216-
flush(offset, size, /)
215+
.. method:: flush([offset[, size]])
217216

218217
Flushes changes made to the in-memory copy of a file back to disk. Without
219218
use of this call there is no guarantee that changes are written back before
@@ -230,6 +229,12 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
230229
on error under Windows. A zero value was returned on success; an
231230
exception was raised on error under Unix.
232231

232+
.. versionchanged:: next
233+
Allow specifying *offset* without *size*. Previously, both *offset*
234+
and *size* parameters were required together. Now *offset* can be
235+
specified alone, and the flush operation will extend from *offset*
236+
to the end of the mmap.
237+
233238

234239
.. method:: madvise(option[, start[, length]])
235240

Doc/library/sqlite3.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,9 @@ Cursor objects
16111611
If the *size* parameter is used, then it is best for it to retain the same
16121612
value from one :meth:`fetchmany` call to the next.
16131613

1614+
.. versionchanged:: next
1615+
Negative *size* values are rejected by raising :exc:`ValueError`.
1616+
16141617
.. method:: fetchall()
16151618

16161619
Return all (remaining) rows of a query result as a :class:`list`.
@@ -1638,6 +1641,9 @@ Cursor objects
16381641
Read/write attribute that controls the number of rows returned by :meth:`fetchmany`.
16391642
The default value is 1 which means a single row would be fetched per call.
16401643

1644+
.. versionchanged:: next
1645+
Negative values are rejected by raising :exc:`ValueError`.
1646+
16411647
.. attribute:: connection
16421648

16431649
Read-only attribute that provides the SQLite database :class:`Connection`

Doc/tools/templates/download.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ <h1>{% trans %}Download Python {{ dl_version }} documentation{% endtrans %}</h1>
4040
<th>{% trans %}Packed as .zip{% endtrans %}</th>
4141
<th>{% trans %}Packed as .tar.bz2{% endtrans %}</th>
4242
</tr>
43-
<tr>
44-
<td>{% trans %}PDF{% endtrans %}</td>
45-
<td>{% trans download_size="17" %}<a href="{{ dl_base }}/python-{{ dl_version }}-docs-pdf-a4.zip">Download</a> (ca. {{ download_size }} MiB){% endtrans %}</td>
46-
<td>{% trans download_size="17" %}<a href="{{ dl_base }}/python-{{ dl_version }}-docs-pdf-a4.tar.bz2">Download</a> (ca. {{ download_size }} MiB){% endtrans %}</td>
47-
</tr>
4843
<tr>
4944
<td>{% trans %}HTML{% endtrans %}</td>
5045
<td>{% trans download_size="13" %}<a href="{{ dl_base }}/python-{{ dl_version }}-docs-html.zip">Download</a> (ca. {{ download_size }} MiB){% endtrans %}</td>
@@ -69,6 +64,13 @@ <h1>{% trans %}Download Python {{ dl_version }} documentation{% endtrans %}</h1>
6964

7065
<p>{% trans %}These archives contain all the content in the documentation.{% endtrans %}</p>
7166

67+
<p>{% trans %}
68+
We no longer provide pre-built PDFs of the documentation.
69+
To build a PDF archive, follow the instructions in the
70+
<a href="https://devguide.python.org/documentation/start-documenting/#building-the-documentation">Developer's Guide</a>
71+
and run <code>make dist-pdf</code> in the <code>Doc/</code> directory of a copy of the CPython repository.
72+
{% endtrans %}</p>
73+
7274

7375
<h2>{% trans %}Unpacking{% endtrans %}</h2>
7476

Doc/whatsnew/3.14.rst

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,25 +2668,34 @@ urllib
26682668
Deprecated
26692669
==========
26702670

2671+
New Deprecations
2672+
----------------
2673+
2674+
* Passing a complex number as the *real* or *imag* argument in the
2675+
:func:`complex` constructor is now deprecated;
2676+
complex numbers should only be passed as a single positional argument.
2677+
(Contributed by Serhiy Storchaka in :gh:`109218`.)
2678+
26712679
* :mod:`argparse`:
26722680

2673-
* Passing the undocumented keyword argument *prefix_chars* to
2674-
:meth:`~argparse.ArgumentParser.add_argument_group` is now
2675-
deprecated.
2681+
* Passing the undocumented keyword argument *prefix_chars* to the
2682+
:meth:`~argparse.ArgumentParser.add_argument_group` method is now deprecated.
26762683
(Contributed by Savannah Ostrowski in :gh:`125563`.)
2684+
26772685
* Deprecated the :class:`argparse.FileType` type converter.
2678-
Anything with resource management should be done downstream after the
2679-
arguments are parsed.
2686+
Anything relating to resource management should be handled
2687+
downstream, after the arguments have been parsed.
26802688
(Contributed by Serhiy Storchaka in :gh:`58032`.)
26812689

26822690
* :mod:`asyncio`:
26832691

2684-
* :func:`!asyncio.iscoroutinefunction` is deprecated
2692+
* The :func:`!asyncio.iscoroutinefunction` is now deprecated
26852693
and will be removed in Python 3.16;
26862694
use :func:`inspect.iscoroutinefunction` instead.
26872695
(Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)
26882696

2689-
* :mod:`asyncio` policy system is deprecated and will be removed in Python 3.16.
2697+
* The :mod:`asyncio` policy system is deprecated
2698+
and will be removed in Python 3.16.
26902699
In particular, the following classes and functions are deprecated:
26912700

26922701
* :class:`asyncio.AbstractEventLoopPolicy`
@@ -2697,99 +2706,102 @@ Deprecated
26972706
* :func:`asyncio.set_event_loop_policy`
26982707

26992708
Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with
2700-
*loop_factory* to use the desired event loop implementation.
2709+
the *loop_factory* argument to use the desired event loop implementation.
27012710

2702-
For example, to use :class:`asyncio.SelectorEventLoop` on Windows::
2711+
For example, to use :class:`asyncio.SelectorEventLoop` on Windows:
27032712

2704-
import asyncio
2713+
.. code-block:: python
27052714
2706-
async def main():
2707-
...
2715+
import asyncio
27082716
2709-
asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)
2717+
async def main():
2718+
...
27102719
2711-
(Contributed by Kumar Aditya in :gh:`127949`.)
2720+
asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)
27122721
2713-
* :mod:`builtins`:
2714-
Passing a complex number as the *real* or *imag* argument in the
2715-
:func:`complex` constructor is now deprecated; it should only be passed
2716-
as a single positional argument.
2717-
(Contributed by Serhiy Storchaka in :gh:`109218`.)
2722+
(Contributed by Kumar Aditya in :gh:`127949`.)
27182723

27192724
* :mod:`codecs`:
2720-
:func:`codecs.open` is now deprecated. Use :func:`open` instead.
2725+
The :func:`codecs.open` function is now deprecated,
2726+
and will be removed in a future version of Python.
2727+
Use :func:`open` instead.
27212728
(Contributed by Inada Naoki in :gh:`133036`.)
27222729

27232730
* :mod:`ctypes`:
27242731

27252732
* On non-Windows platforms, setting :attr:`.Structure._pack_` to use a
2726-
MSVC-compatible default memory layout is deprecated in favor of setting
2727-
:attr:`.Structure._layout_` to ``'ms'``.
2733+
MSVC-compatible default memory layout is now deprecated in favor of setting
2734+
:attr:`.Structure._layout_` to ``'ms'``, and will be removed in Python 3.19.
27282735
(Contributed by Petr Viktorin in :gh:`131747`.)
27292736

2730-
* Calling :func:`ctypes.POINTER` on a string is deprecated.
2731-
Use :ref:`ctypes-incomplete-types` for self-referential structures.
2737+
* Calling :func:`ctypes.POINTER` on a string is now deprecated.
2738+
Use :ref:`incomplete types <ctypes-incomplete-types>`
2739+
for self-referential structures.
27322740
Also, the internal ``ctypes._pointer_type_cache`` is deprecated.
27332741
See :func:`ctypes.POINTER` for updated implementation details.
27342742
(Contributed by Sergey Myrianov in :gh:`100926`.)
27352743

27362744
* :mod:`functools`:
27372745
Calling the Python implementation of :func:`functools.reduce` with *function*
2738-
or *sequence* as keyword arguments is now deprecated.
2746+
or *sequence* as keyword arguments is now deprecated;
2747+
the parameters will be made positional-only in Python 3.16.
27392748
(Contributed by Kirill Podoprigora in :gh:`121676`.)
27402749

27412750
* :mod:`logging`:
2742-
Support for custom logging handlers with the *strm* argument is deprecated
2743-
and scheduled for removal in Python 3.16. Define handlers with the *stream*
2744-
argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)
2751+
Support for custom logging handlers with the *strm* argument
2752+
is now deprecated and scheduled for removal in Python 3.16.
2753+
Define handlers with the *stream* argument instead.
2754+
(Contributed by Mariusz Felisiak in :gh:`115032`.)
27452755

27462756
* :mod:`mimetypes`:
2747-
Valid extensions start with a '.' or are empty for
2757+
Valid extensions are either empty or must start with '.' for
27482758
:meth:`mimetypes.MimeTypes.add_type`.
27492759
Undotted extensions are deprecated and will
27502760
raise a :exc:`ValueError` in Python 3.16.
27512761
(Contributed by Hugo van Kemenade in :gh:`75223`.)
27522762

2753-
* :mod:`!nturl2path`: This module is now deprecated. Call
2754-
:func:`urllib.request.url2pathname` and :func:`~urllib.request.pathname2url`
2755-
instead.
2763+
* :mod:`!nturl2path`:
2764+
This module is now deprecated. Call :func:`urllib.request.url2pathname`
2765+
and :func:`~urllib.request.pathname2url` instead.
27562766
(Contributed by Barney Gale in :gh:`125866`.)
27572767

27582768
* :mod:`os`:
2759-
:term:`Soft deprecate <soft deprecated>` :func:`os.popen` and
2760-
:func:`os.spawn* <os.spawnl>` functions. They should no longer be used to
2761-
write new code. The :mod:`subprocess` module is recommended instead.
2769+
The :func:`os.popen` and :func:`os.spawn* <os.spawnl>` functions
2770+
are now :term:`soft deprecated`.
2771+
They should no longer be used to write new code.
2772+
The :mod:`subprocess` module is recommended instead.
27622773
(Contributed by Victor Stinner in :gh:`120743`.)
27632774

27642775
* :mod:`pathlib`:
2765-
:meth:`!pathlib.PurePath.as_uri` is deprecated and will be removed in Python
2766-
3.19. Use :meth:`pathlib.Path.as_uri` instead.
2776+
:meth:`!pathlib.PurePath.as_uri` is now deprecated
2777+
and scheduled for removal in Python 3.19.
2778+
Use :meth:`pathlib.Path.as_uri` instead.
27672779
(Contributed by Barney Gale in :gh:`123599`.)
27682780

27692781
* :mod:`pdb`:
27702782
The undocumented ``pdb.Pdb.curframe_locals`` attribute is now a deprecated
2771-
read-only property. The low overhead dynamic frame locals access added in
2772-
Python 3.13 by PEP 667 means the frame locals cache reference previously
2773-
stored in this attribute is no longer needed. Derived debuggers should access
2783+
read-only property, which will be removed in a future version of Python.
2784+
The low overhead dynamic frame locals access added in Python 3.13 by :pep:`667`
2785+
means the frame locals cache reference previously stored in this attribute
2786+
is no longer needed. Derived debuggers should access
27742787
``pdb.Pdb.curframe.f_locals`` directly in Python 3.13 and later versions.
27752788
(Contributed by Tian Gao in :gh:`124369` and :gh:`125951`.)
27762789

27772790
* :mod:`symtable`:
2778-
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest.
2791+
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest,
2792+
scheduled for removal in Python 3.16.
27792793
(Contributed by Bénédikt Tran in :gh:`119698`.)
27802794

27812795
* :mod:`tkinter`:
27822796
The :class:`!tkinter.Variable` methods :meth:`!trace_variable`,
27832797
:meth:`!trace_vdelete` and :meth:`!trace_vinfo` are now deprecated.
2784-
Use :meth:`!trace_add`, :meth:`!trace_remove` and :meth:`!trace_info`
2785-
instead.
2798+
Use :meth:`!trace_add`, :meth:`!trace_remove` and :meth:`!trace_info` instead.
27862799
(Contributed by Serhiy Storchaka in :gh:`120220`.)
27872800

27882801
* :mod:`urllib.parse`:
27892802
Accepting objects with false values (like ``0`` and ``[]``) except empty
2790-
strings, byte-like objects and ``None`` in :mod:`urllib.parse` functions
2791-
:func:`~urllib.parse.parse_qsl` and :func:`~urllib.parse.parse_qs` is now
2792-
deprecated.
2803+
strings, bytes-like objects and ``None`` in :func:`~urllib.parse.parse_qsl`
2804+
and :func:`~urllib.parse.parse_qs` is now deprecated.
27932805
(Contributed by Serhiy Storchaka in :gh:`116897`.)
27942806

27952807
.. Add deprecations above alphabetically, not here at the end.

0 commit comments

Comments
 (0)