Skip to content

Commit e8d8c4b

Browse files
committed
Merge branch 'main' into c-recursion-limit
2 parents 22ca169 + 247b50d commit e8d8c4b

Some content is hidden

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

44 files changed

+437
-374
lines changed

Doc/c-api/init.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ Process-wide parameters
604604
interpreter will change the contents of this storage.
605605
606606
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
607-
:c:expr:`wchar_*` string.
607+
:c:expr:`wchar_t*` string.
608608
609609
.. deprecated-removed:: 3.11 3.15
610610
@@ -852,7 +852,7 @@ Process-wide parameters
852852
directory (``"."``).
853853
854854
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
855-
:c:expr:`wchar_*` string.
855+
:c:expr:`wchar_t*` string.
856856
857857
See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv`
858858
members of the :ref:`Python Initialization Configuration <init-config>`.
@@ -888,7 +888,7 @@ Process-wide parameters
888888
:option:`-I`.
889889
890890
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
891-
:c:expr:`wchar_*` string.
891+
:c:expr:`wchar_t*` string.
892892
893893
See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv`
894894
members of the :ref:`Python Initialization Configuration <init-config>`.
@@ -914,7 +914,7 @@ Process-wide parameters
914914
this storage.
915915
916916
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
917-
:c:expr:`wchar_*` string.
917+
:c:expr:`wchar_t*` string.
918918
919919
.. deprecated-removed:: 3.11 3.15
920920

Doc/c-api/unicode.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,13 @@ the user settings on the machine running the codec.
13521352
in *consumed*.
13531353
13541354
1355+
.. c:function:: PyObject* PyUnicode_DecodeCodePageStateful(int code_page, const char *str, \
1356+
Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
1357+
1358+
Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page
1359+
specified by *code_page*.
1360+
1361+
13551362
.. c:function:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode)
13561363
13571364
Encode a Unicode object using MBCS and return the result as Python bytes

Doc/data/refcounts.dat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,6 +2636,13 @@ PyUnicode_DecodeMBCSStateful:Py_ssize_t:size::
26362636
PyUnicode_DecodeMBCSStateful:const char*:errors::
26372637
PyUnicode_DecodeMBCSStateful:Py_ssize_t*:consumed::
26382638

2639+
PyUnicode_DecodeCodePageStateful:PyObject*::+1:
2640+
PyUnicode_DecodeCodePageStateful:int:code_page::
2641+
PyUnicode_DecodeCodePageStateful:const char*:s::
2642+
PyUnicode_DecodeCodePageStateful:Py_ssize_t:size::
2643+
PyUnicode_DecodeCodePageStateful:const char*:errors::
2644+
PyUnicode_DecodeCodePageStateful:Py_ssize_t*:consumed::
2645+
26392646
PyUnicode_EncodeCodePage:PyObject*::+1:
26402647
PyUnicode_EncodeCodePage:int:code_page::
26412648
PyUnicode_EncodeCodePage:PyObject*:unicode:0:

Doc/library/dbm.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ The :mod:`!dbm.dumb` module defines the following:
455455
.. method:: dumbdbm.sync()
456456

457457
Synchronize the on-disk directory and data files. This method is called
458-
by the :meth:`Shelve.sync` method.
458+
by the :meth:`shelve.Shelf.sync` method.
459459

460460
.. method:: dumbdbm.close()
461461

Doc/library/logging.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,12 @@ subclasses. However, the :meth:`!__init__` method in subclasses needs to call
592592

593593
.. method:: Handler.close()
594594

595-
Tidy up any resources used by the handler. This version does no output but
596-
removes the handler from an internal list of handlers which is closed when
597-
:func:`shutdown` is called. Subclasses should ensure that this gets called
598-
from overridden :meth:`close` methods.
595+
Tidy up any resources used by the handler. This version does no output
596+
but removes the handler from an internal map of handlers, which is used
597+
for handler lookup by name.
598+
599+
Subclasses should ensure that this gets called from overridden :meth:`close`
600+
methods.
599601

600602

601603
.. method:: Handler.handle(record)

Doc/library/plistlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ This module defines the following functions:
9999

100100
.. function:: dump(value, fp, *, fmt=FMT_XML, sort_keys=True, skipkeys=False, aware_datetime=False)
101101

102-
Write *value* to a plist file. *Fp* should be a writable, binary
102+
Write *value* to a plist file. *fp* should be a writable, binary
103103
file object.
104104

105105
The *fmt* argument specifies the format of the plist file and can be

Doc/library/smtplib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ An :class:`SMTP` instance has the following methods:
524524
:mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers that may appear
525525
in *msg*. If any of the addresses in *from_addr* and *to_addrs* contain
526526
non-ASCII characters and the server does not advertise ``SMTPUTF8`` support,
527-
an :exc:`SMTPNotSupported` error is raised. Otherwise the ``Message`` is
527+
an :exc:`SMTPNotSupportedError` is raised. Otherwise the ``Message`` is
528528
serialized with a clone of its :mod:`~email.policy` with the
529529
:attr:`~email.policy.EmailPolicy.utf8` attribute set to ``True``, and
530530
``SMTPUTF8`` and ``BODY=8BITMIME`` are added to *mail_options*.

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Doc/library/ast.rst
1616
Doc/library/asyncio-extending.rst
1717
Doc/library/asyncio-subprocess.rst
1818
Doc/library/collections.rst
19-
Doc/library/dbm.rst
2019
Doc/library/decimal.rst
2120
Doc/library/email.charset.rst
2221
Doc/library/email.compat32-message.rst

Doc/whatsnew/3.12.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ Build Changes
18191819
* ``PYTHON_FOR_REGEN`` now require Python 3.10 or newer.
18201820

18211821
* Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate
1822-
:file:`!configure`.
1822+
:file:`configure`.
18231823
(Contributed by Christian Heimes in :gh:`89886`.)
18241824

18251825
* Windows builds and macOS installers from python.org now use OpenSSL 3.0.

Doc/whatsnew/3.14.rst

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ A new type of interpreter based on tail calls has been added to CPython.
218218
For certain newer compilers, this interpreter provides
219219
significantly better performance. Preliminary numbers on our machines suggest
220220
anywhere from -3% to 30% faster Python code, and a geometric mean of 9-15%
221-
faster on ``pyperformance`` depending on platform and architecture.
221+
faster on ``pyperformance`` depending on platform and architecture. The
222+
baseline is Python 3.14 built with Clang 19 without this new interpreter.
222223

223224
This interpreter currently only works with Clang 19 and newer
224225
on x86-64 and AArch64 architectures. However, we expect
@@ -366,7 +367,7 @@ ctypes
366367

367368
* The layout of :ref:`bit fields <ctypes-bit-fields-in-structures-unions>`
368369
in :class:`~ctypes.Structure` and :class:`~ctypes.Union`
369-
now matches platform defaults (GCC/Clang or MVSC) more closely.
370+
now matches platform defaults (GCC/Clang or MSVC) more closely.
370371
In particular, fields no longer overlap.
371372
(Contributed by Matthias Görgens in :gh:`97702`.)
372373

@@ -410,6 +411,13 @@ decimal
410411
:meth:`Decimal.from_number() <decimal.Decimal.from_number>`.
411412
(Contributed by Serhiy Storchaka in :gh:`121798`.)
412413

414+
difflib
415+
-------
416+
417+
* Comparison pages with highlighted changes generated by the
418+
:class:`difflib.HtmlDiff` class now support dark mode.
419+
(Contributed by Jiahao Li in :gh:`129939`.)
420+
413421
dis
414422
---
415423

@@ -480,6 +488,14 @@ http
480488
(Contributed by Yorik Hansen in :gh:`123430`.)
481489

482490

491+
imaplib
492+
-------
493+
494+
* Add :meth:`IMAP4.idle() <imaplib.IMAP4.idle>`, implementing the IMAP4
495+
``IDLE`` command as defined in :rfc:`2177`.
496+
(Contributed by Forest in :gh:`55454`.)
497+
498+
483499
inspect
484500
-------
485501

@@ -495,13 +511,6 @@ inspect
495511
:term:`package` or not.
496512
(Contributed by Zhikang Yan in :gh:`125634`.)
497513

498-
imaplib
499-
-------
500-
501-
* Add :meth:`IMAP4.idle() <imaplib.IMAP4.idle>`, implementing the IMAP4
502-
``IDLE`` command as defined in :rfc:`2177`.
503-
(Contributed by Forest in :gh:`55454`.)
504-
505514

506515
io
507516
--
@@ -630,7 +639,6 @@ pathlib
630639
:func:`~os.stat` results. Path objects generated by
631640
:meth:`~pathlib.Path.iterdir` are initialized with file type information
632641
gleaned from scanning the parent directory.
633-
634642
(Contributed by Barney Gale in :gh:`125413`.)
635643

636644

@@ -669,7 +677,6 @@ platform
669677
--------
670678

671679
* Add :func:`platform.invalidate_caches` to invalidate the cached results.
672-
673680
(Contributed by Bénédikt Tran in :gh:`122549`.)
674681

675682

@@ -808,13 +815,11 @@ zipinfo
808815
* Added :func:`ZipInfo._for_archive <zipfile.ZipInfo._for_archive>`
809816
to resolve suitable defaults for a :class:`~zipfile.ZipInfo` object
810817
as used by :func:`ZipFile.writestr <zipfile.ZipFile.writestr>`.
811-
812818
(Contributed by Bénédikt Tran in :gh:`123424`.)
813819

814820
* :meth:`zipfile.ZipFile.writestr` now respect ``SOURCE_DATE_EPOCH`` that
815821
distributions can set centrally and have build tools consume this in order
816822
to produce reproducible output.
817-
818823
(Contributed by Jiahao Li in :gh:`91279`.)
819824

820825
.. Add improved modules above alphabetically, not here at the end.
@@ -1003,7 +1008,6 @@ ast
10031008
* :attr:`!ast.Constant.s`
10041009

10051010
Use :attr:`!ast.Constant.value` instead.
1006-
10071011
(Contributed by Alex Waygood in :gh:`119562`.)
10081012

10091013
asyncio
@@ -1212,7 +1216,6 @@ urllib
12121216
:func:`~urllib.request.urlretrieve`. Customizations to the opener
12131217
classes can be replaced by passing customized handlers to
12141218
:func:`~urllib.request.build_opener`.
1215-
12161219
(Contributed by Barney Gale in :gh:`84850`.)
12171220

12181221
Others
@@ -1465,6 +1468,8 @@ Porting to Python 3.14
14651468
.. _pythoncapi-compat project: https://github.com/python/pythoncapi-compat/
14661469

14671470

1471+
.. _whatsnew314-c-api-deprecated:
1472+
14681473
Deprecated
14691474
----------
14701475

@@ -1504,17 +1509,17 @@ Deprecated
15041509

15051510
The `pythoncapi-compat project`_ can be used to get these new public
15061511
functions on Python 3.13 and older.
1507-
15081512
(Contributed by Victor Stinner in :gh:`128863`.)
15091513

1510-
15111514
.. include:: ../deprecations/c-api-pending-removal-in-3.15.rst
15121515

15131516
.. include:: ../deprecations/c-api-pending-removal-in-3.18.rst
15141517

15151518
.. include:: ../deprecations/c-api-pending-removal-in-future.rst
15161519

15171520

1521+
.. _whatsnew314-c-api-removed:
1522+
15181523
Removed
15191524
-------
15201525

Include/internal/pycore_object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ PyAPI_DATA(Py_ssize_t) _Py_RefTotal;
121121

122122
extern void _Py_AddRefTotal(PyThreadState *, Py_ssize_t);
123123
extern PyAPI_FUNC(void) _Py_IncRefTotal(PyThreadState *);
124-
extern void _Py_DecRefTotal(PyThreadState *);
124+
extern PyAPI_FUNC(void) _Py_DecRefTotal(PyThreadState *);
125125

126126
# define _Py_DEC_REFTOTAL(interp) \
127127
interp->object_state.reftotal--
@@ -710,7 +710,7 @@ _PyObject_SetMaybeWeakref(PyObject *op)
710710
}
711711
}
712712

713-
extern int _PyObject_ResurrectEndSlow(PyObject *op);
713+
extern PyAPI_FUNC(int) _PyObject_ResurrectEndSlow(PyObject *op);
714714
#endif
715715

716716
// Temporarily resurrects an object during deallocation. The refcount is set

Lib/difflib.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,13 +1632,22 @@ def _line_pair_iterator():
16321632
</html>"""
16331633

16341634
_styles = """
1635+
:root {color-scheme: light dark}
16351636
table.diff {font-family:Courier; border:medium;}
16361637
.diff_header {background-color:#e0e0e0}
16371638
td.diff_header {text-align:right}
16381639
.diff_next {background-color:#c0c0c0}
1639-
.diff_add {background-color:#aaffaa}
1640+
.diff_add {background-color:palegreen}
16401641
.diff_chg {background-color:#ffff77}
1641-
.diff_sub {background-color:#ffaaaa}"""
1642+
.diff_sub {background-color:#ffaaaa}
1643+
1644+
@media (prefers-color-scheme: dark) {
1645+
.diff_header {background-color:#666}
1646+
.diff_next {background-color:#393939}
1647+
.diff_add {background-color:darkgreen}
1648+
.diff_chg {background-color:#847415}
1649+
.diff_sub {background-color:darkred}
1650+
}"""
16421651

16431652
_table_template = """
16441653
<table class="diff" id="difflib_chg_%(prefix)s_top"

Lib/ensurepip/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
__all__ = ["version", "bootstrap"]
13-
_PIP_VERSION = "24.3.1"
13+
_PIP_VERSION = "25.0.1"
1414

1515
# Directory of system wheel packages. Some Linux distribution packaging
1616
# policies recommend against bundling dependencies. For example, Fedora

Lib/logging/handlers.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,8 @@ def __init__(self, mailhost, fromaddr, toaddrs, subject,
10431043
only be used when authentication credentials are supplied. The tuple
10441044
will be either an empty tuple, or a single-value tuple with the name
10451045
of a keyfile, or a 2-value tuple with the names of the keyfile and
1046-
certificate file. (This tuple is passed to the `starttls` method).
1046+
certificate file. (This tuple is passed to the
1047+
`ssl.SSLContext.load_cert_chain` method).
10471048
A timeout in seconds can be specified for the SMTP connection (the
10481049
default is one second).
10491050
"""
@@ -1096,8 +1097,23 @@ def emit(self, record):
10961097
msg.set_content(self.format(record))
10971098
if self.username:
10981099
if self.secure is not None:
1100+
import ssl
1101+
1102+
try:
1103+
keyfile = self.secure[0]
1104+
except IndexError:
1105+
keyfile = None
1106+
1107+
try:
1108+
certfile = self.secure[1]
1109+
except IndexError:
1110+
certfile = None
1111+
1112+
context = ssl._create_stdlib_context(
1113+
certfile=certfile, keyfile=keyfile
1114+
)
10991115
smtp.ehlo()
1100-
smtp.starttls(*self.secure)
1116+
smtp.starttls(context=context)
11011117
smtp.ehlo()
11021118
smtp.login(self.username, self.password)
11031119
smtp.send_message(msg)

Lib/test/test_asyncio/test_tasks.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,6 +2296,22 @@ async def kill_me(loop):
22962296

22972297
self.assertEqual(self.all_tasks(loop=self.loop), set())
22982298

2299+
def test_task_not_crash_without_finalization(self):
2300+
Task = self.__class__.Task
2301+
2302+
class Subclass(Task):
2303+
def __del__(self):
2304+
pass
2305+
2306+
async def coro():
2307+
await asyncio.sleep(0.01)
2308+
2309+
task = Subclass(coro(), loop = self.loop)
2310+
task._log_destroy_pending = False
2311+
2312+
del task
2313+
2314+
support.gc_collect()
22992315

23002316
@mock.patch('asyncio.base_events.logger')
23012317
def test_tb_logger_not_called_after_cancel(self, m_log):

Lib/test/test_ctypes/test_dlerror.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ def test_null_dlsym(self):
5858
import subprocess
5959
import tempfile
6060

61-
retcode = subprocess.call(["gcc", "--version"],
62-
stdout=subprocess.DEVNULL,
63-
stderr=subprocess.DEVNULL)
64-
if retcode != 0:
61+
try:
62+
retcode = subprocess.call(["gcc", "--version"],
63+
stdout=subprocess.DEVNULL,
64+
stderr=subprocess.DEVNULL)
65+
except OSError:
6566
self.skipTest("gcc is missing")
67+
if retcode != 0:
68+
self.skipTest("gcc --version failed")
6669

6770
pipe_r, pipe_w = os.pipe()
6871
self.addCleanup(os.close, pipe_r)

0 commit comments

Comments
 (0)