Skip to content

Commit 9cee9ff

Browse files
committed
Merge branch 'main' into tstrings
2 parents 8468e10 + 4c20f46 commit 9cee9ff

File tree

121 files changed

+13923
-2210
lines changed

Some content is hidden

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

121 files changed

+13923
-2210
lines changed

.github/workflows/build.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ jobs:
264264
fail-fast: false
265265
matrix:
266266
os: [ubuntu-24.04]
267-
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2, 3.4.0]
267+
openssl_ver: [3.0.16, 3.1.8, 3.2.4, 3.3.3, 3.4.1]
268268
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
269269
env:
270270
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -331,7 +331,7 @@ jobs:
331331
needs: build-context
332332
if: needs.build-context.outputs.run-tests == 'true'
333333
env:
334-
OPENSSL_VER: 3.0.15
334+
OPENSSL_VER: 3.0.16
335335
PYTHONSTRICTEXTENSIONBUILD: 1
336336
steps:
337337
- uses: actions/checkout@v4
@@ -422,8 +422,9 @@ jobs:
422422
# failing when executed from inside a virtual environment.
423423
"${VENV_PYTHON}" -m test \
424424
-W \
425-
-o \
425+
--slowest \
426426
-j4 \
427+
--timeout 900 \
427428
-x test_asyncio \
428429
-x test_multiprocessing_fork \
429430
-x test_multiprocessing_forkserver \
@@ -450,7 +451,7 @@ jobs:
450451
matrix:
451452
os: [ubuntu-24.04]
452453
env:
453-
OPENSSL_VER: 3.0.15
454+
OPENSSL_VER: 3.0.16
454455
PYTHONSTRICTEXTENSIONBUILD: 1
455456
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
456457
steps:

Doc/c-api/arg.rst

+2
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ Building values
669669
``L`` (:class:`int`) [long long]
670670
Convert a C :c:expr:`long long` to a Python integer object.
671671
672+
.. _capi-py-buildvalue-format-K:
673+
672674
``K`` (:class:`int`) [unsigned long long]
673675
Convert a C :c:expr:`unsigned long long` to a Python integer object.
674676

Doc/c-api/init_config.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Configuration Options
320320
* - ``"cpu_count"``
321321
- :c:member:`cpu_count <PyConfig.cpu_count>`
322322
- ``int``
323-
- Read-only
323+
- Public
324324
* - ``"dev_mode"``
325325
- :c:member:`dev_mode <PyConfig.dev_mode>`
326326
- ``bool``
@@ -619,6 +619,8 @@ Some options are read from the :mod:`sys` attributes. For example, the option
619619
The caller must have an :term:`attached thread state`. The function cannot
620620
be called before Python initialization nor after Python finalization.
621621
622+
.. audit-event:: cpython.PyConfig_Set name,value c.PyConfig_Set
623+
622624
.. versionadded:: 3.14
623625
624626

Doc/c-api/intro.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ complete listing.
148148
.. c:macro:: Py_ALWAYS_INLINE
149149
150150
Ask the compiler to always inline a static inline function. The compiler can
151-
ignore it and decides to not inline the function.
151+
ignore it and decide to not inline the function.
152152

153153
It can be used to inline performance critical static inline functions when
154154
building Python in debug mode with function inlining disabled. For example,

Doc/deprecations/c-api-pending-removal-in-3.15.rst

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ Pending removal in Python 3.15
1010
:c:func:`PyWeakref_GetRef` on Python 3.12 and older.
1111
* :c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro:
1212
Use :c:type:`wchar_t` instead.
13+
* :c:func:`!PyUnicode_AsDecodedObject`:
14+
Use :c:func:`PyCodec_Decode` instead.
15+
* :c:func:`!PyUnicode_AsDecodedUnicode`:
16+
Use :c:func:`PyCodec_Decode` instead; Note that some codecs (for example, "base64")
17+
may return a type other than :class:`str`, such as :class:`bytes`.
18+
* :c:func:`!PyUnicode_AsEncodedObject`:
19+
Use :c:func:`PyCodec_Encode` instead.
20+
* :c:func:`!PyUnicode_AsEncodedUnicode`:
21+
Use :c:func:`PyCodec_Encode` instead; Note that some codecs (for example, "base64")
22+
may return a type other than :class:`bytes`, such as :class:`str`.
1323
* Python initialization functions, deprecated in Python 3.13:
1424

1525
* :c:func:`Py_GetPath`:

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

-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ although there is currently no date scheduled for their removal.
1818
Use :c:func:`PyOS_AfterFork_Child` instead.
1919
* :c:func:`PySlice_GetIndicesEx`:
2020
Use :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices` instead.
21-
* :c:func:`!PyUnicode_AsDecodedObject`:
22-
Use :c:func:`PyCodec_Decode` instead.
23-
* :c:func:`!PyUnicode_AsDecodedUnicode`:
24-
Use :c:func:`PyCodec_Decode` instead.
25-
* :c:func:`!PyUnicode_AsEncodedObject`:
26-
Use :c:func:`PyCodec_Encode` instead.
27-
* :c:func:`!PyUnicode_AsEncodedUnicode`:
28-
Use :c:func:`PyCodec_Encode` instead.
2921
* :c:func:`PyUnicode_READY`:
3022
Unneeded since Python 3.12
3123
* :c:func:`!PyErr_Display`:

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

+3
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,6 @@ although there is currently no date scheduled for their removal.
153153
:class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
154154
will always return ``True``. Prefer explicit ``len(elem)`` or
155155
``elem is not None`` tests instead.
156+
157+
* :func:`sys._clear_type_cache` is deprecated:
158+
use :func:`sys._clear_internal_caches` instead.

Doc/library/decimal.rst

+2
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ Decimal objects
367367
appears above. These include decimal digits from various other
368368
alphabets (for example, Arabic-Indic and Devanāgarī digits) along
369369
with the fullwidth digits ``'\uff10'`` through ``'\uff19'``.
370+
Case is not significant, so, for example, ``inf``, ``Inf``, ``INFINITY``,
371+
and ``iNfINity`` are all acceptable spellings for positive infinity.
370372

371373
If *value* is a :class:`tuple`, it should have three components, a sign
372374
(``0`` for positive or ``1`` for negative), a :class:`tuple` of

Doc/library/fcntl.rst

+13-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ descriptor.
7979
On macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE``
8080
and ``F_SETNOSIGPIPE`` constant.
8181

82+
.. versionchanged:: next
83+
On Linux >= 6.1, the :mod:`!fcntl` module exposes the ``F_DUPFD_QUERY``
84+
to query a file descriptor pointing to the same file.
85+
8286
The module defines the following functions:
8387

8488

@@ -89,14 +93,14 @@ The module defines the following functions:
8993
for *cmd* are operating system dependent, and are available as constants
9094
in the :mod:`fcntl` module, using the same names as used in the relevant C
9195
header files. The argument *arg* can either be an integer value, a
92-
:class:`bytes` object, or a string.
96+
:term:`bytes-like object`, or a string.
9397
The type and size of *arg* must match the type and size of
9498
the argument of the operation as specified in the relevant C documentation.
9599

96100
When *arg* is an integer, the function returns the integer
97101
return value of the C :c:func:`fcntl` call.
98102

99-
When the argument is bytes, it represents a binary structure,
103+
When the argument is bytes-like object, it represents a binary structure,
100104
for example, created by :func:`struct.pack`.
101105
A string value is encoded to binary using the UTF-8 encoding.
102106
The binary data is copied to a buffer whose address is
@@ -117,6 +121,10 @@ The module defines the following functions:
117121

118122
.. audit-event:: fcntl.fcntl fd,cmd,arg fcntl.fcntl
119123

124+
.. versionchanged:: next
125+
Add support of arbitrary :term:`bytes-like objects <bytes-like object>`,
126+
not only :class:`bytes`.
127+
120128

121129
.. function:: ioctl(fd, request, arg=0, mutate_flag=True, /)
122130

@@ -173,6 +181,9 @@ The module defines the following functions:
173181

174182
.. audit-event:: fcntl.ioctl fd,request,arg fcntl.ioctl
175183

184+
.. versionchanged:: next
185+
The GIL is always released during a system call.
186+
System calls failing with EINTR are automatically retried.
176187

177188
.. function:: flock(fd, operation, /)
178189

Doc/library/gzip.rst

+4
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ Example of how to GZIP compress a binary string::
258258
The basic data compression module needed to support the :program:`gzip` file
259259
format.
260260

261+
In case gzip (de)compression is a bottleneck, the `python-isal`_
262+
package speeds up (de)compression with a mostly compatible API.
263+
264+
.. _python-isal: https://github.com/pycompression/python-isal
261265

262266
.. program:: gzip
263267

Doc/library/sys.monitoring.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ More events may be added in the future.
160160

161161
These events are attributes of the :mod:`!sys.monitoring.events` namespace.
162162
Each event is represented as a power-of-2 integer constant.
163-
To define a set of events, simply bitwise or the individual events together.
163+
To define a set of events, simply bitwise OR the individual events together.
164164
For example, to specify both :monitoring-event:`PY_RETURN` and :monitoring-event:`PY_START`
165165
events, use the expression ``PY_RETURN | PY_START``.
166166

Doc/library/webbrowser.rst

+13-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,17 @@ If the environment variable :envvar:`BROWSER` exists, it is interpreted as the
2424
:data:`os.pathsep`-separated list of browsers to try ahead of the platform
2525
defaults. When the value of a list part contains the string ``%s``, then it is
2626
interpreted as a literal browser command line to be used with the argument URL
27-
substituted for ``%s``; if the part does not contain ``%s``, it is simply
28-
interpreted as the name of the browser to launch. [1]_
27+
substituted for ``%s``; if the value is a single word that refers to one of the
28+
already registered browsers this browser is added to the front of the search list;
29+
if the part does not contain ``%s``, it is simply interpreted as the name of the
30+
browser to launch. [1]_
31+
32+
.. versionchanged:: next
33+
34+
The :envvar:`BROWSER` variable can now also be used to reorder the list of
35+
platform defaults. This is particularly useful on macOS where the platform
36+
defaults do not refer to command-line tools on :envvar:`PATH`.
37+
2938

3039
For non-Unix platforms, or when a remote browser is available on Unix, the
3140
controlling process will not wait for the user to finish with the browser, but
@@ -226,8 +235,8 @@ Here are some simple examples::
226235
Browser Controller Objects
227236
--------------------------
228237

229-
Browser controllers provide these methods which parallel three of the
230-
module-level convenience functions:
238+
Browser controllers provide the :attr:`~controller.name` attribute,
239+
and the following three methods which parallel module-level convenience functions:
231240

232241

233242
.. attribute:: controller.name

Doc/library/zlib.rst

+5
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,8 @@ the following constants:
353353
http://www.zlib.net/manual.html
354354
The zlib manual explains the semantics and usage of the library's many
355355
functions.
356+
357+
In case gzip (de)compression is a bottleneck, the `python-isal`_
358+
package speeds up (de)compression with a mostly compatible API.
359+
360+
.. _python-isal: https://github.com/pycompression/python-isal

Doc/reference/datamodel.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -1526,18 +1526,17 @@ positional arguments; bit ``0x08`` is set if the function uses the
15261526
if the function is a generator. See :ref:`inspect-module-co-flags` for details
15271527
on the semantics of each flags that might be present.
15281528

1529-
Future feature declarations (``from __future__ import division``) also use bits
1529+
Future feature declarations (for example, ``from __future__ import division``) also use bits
15301530
in :attr:`~codeobject.co_flags` to indicate whether a code object was compiled with a
1531-
particular feature enabled: bit ``0x2000`` is set if the function was compiled
1532-
with future division enabled; bits ``0x10`` and ``0x1000`` were used in earlier
1533-
versions of Python.
1531+
particular feature enabled. See :attr:`~__future__._Feature.compiler_flag`.
15341532

15351533
Other bits in :attr:`~codeobject.co_flags` are reserved for internal use.
15361534

15371535
.. index:: single: documentation string
15381536

15391537
If a code object represents a function and has a docstring,
1540-
the first item in :attr:`~codeobject.co_consts` is
1538+
the :data:`~inspect.CO_HAS_DOCSTRING` bit is set in :attr:`~codeobject.co_flags`
1539+
and the first item in :attr:`~codeobject.co_consts` is
15411540
the docstring of the function.
15421541

15431542
Methods on code objects

Doc/using/configure.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Features and minimum versions required to build CPython:
2222

2323
* Support for threads.
2424

25-
* OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended
25+
* OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.16 is the recommended
2626
minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules.
2727

2828
* SQLite 3.15.2 for the :mod:`sqlite3` extension module.

Doc/whatsnew/3.14.rst

+58-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ PEP 768: Safe external debugger interface for CPython
170170

171171
:pep:`768` introduces a zero-overhead debugging interface that allows debuggers and profilers
172172
to safely attach to running Python processes. This is a significant enhancement to Python's
173-
debugging capabilities allowing debuggers to forego unsafe alternatives.
173+
debugging capabilities allowing debuggers to forego unsafe alternatives. See
174+
:ref:`below <whatsnew314-remote-pdb>` for how this feature is leveraged to
175+
implement the new :mod:`pdb` module's remote attaching capabilities.
174176

175177
The new interface provides safe execution points for attaching debugger code without modifying
176178
the interpreter's normal execution path or adding runtime overhead. This enables tools to
@@ -220,6 +222,32 @@ See :pep:`768` for more details.
220222

221223
(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic in :gh:`131591`.)
222224

225+
226+
.. _whatsnew314-remote-pdb:
227+
228+
Remote attaching to a running Python process with PDB
229+
-----------------------------------------------------
230+
231+
The :mod:`pdb` module now supports remote attaching to a running Python process
232+
using a new ``-p PID`` command-line option:
233+
234+
.. code-block:: sh
235+
236+
python -m pdb -p 1234
237+
238+
This will connect to the Python process with the given PID and allow you to
239+
debug it interactively. Notice that due to how the Python interpreter works
240+
attaching to a remote process that is blocked in a system call or waiting for
241+
I/O will only work once the next bytecode instruction is executed or when the
242+
process receives a signal.
243+
244+
This feature leverages :pep:`768` and the :func:`sys.remote_exec` function
245+
to attach to the remote process and send the PDB commands to it.
246+
247+
248+
(Contributed by Matt Wozniski and Pablo Galindo in :gh:`131591`.)
249+
250+
223251
.. _whatsnew314-pep758:
224252

225253
PEP 758 – Allow except and except* expressions without parentheses
@@ -391,6 +419,21 @@ Improved error messages
391419
^^^^^^^
392420
ValueError: too many values to unpack (expected 3, got 4)
393421
422+
* :keyword:`elif` statements that follow an :keyword:`else` block now have a specific error message.
423+
(Contributed by Steele Farnsworth in :gh:`129902`.)
424+
425+
.. code-block:: pycon
426+
427+
>>> if who == "me":
428+
... print("It's me!")
429+
... else:
430+
... print("It's not me!")
431+
... elif who is None:
432+
... print("Who is it?")
433+
File "<stdin>", line 5
434+
elif who is None:
435+
^^^^
436+
SyntaxError: 'elif' block follows an 'else' block
394437
395438
* If a statement (:keyword:`pass`, :keyword:`del`, :keyword:`return`,
396439
:keyword:`yield`, :keyword:`raise`, :keyword:`break`, :keyword:`continue`,
@@ -1274,6 +1317,9 @@ sys
12741317
* On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore.
12751318
It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``.
12761319

1320+
* Raise :exc:`DeprecationWarning` for :func:`sys._clear_type_cache`. This
1321+
function was deprecated in Python 3.13 but it didn't raise a runtime warning.
1322+
12771323

12781324
sys.monitoring
12791325
--------------
@@ -1449,6 +1495,17 @@ uuid
14491495
(Contributed by Simon Legner in :gh:`131236`.)
14501496

14511497

1498+
webbrowser
1499+
----------
1500+
1501+
* Names in the :envvar:`BROWSER` environment variable can now refer to already
1502+
registered browsers for the :mod:`webbrowser` module, instead of always
1503+
generating a new browser command.
1504+
1505+
This makes it possible to set :envvar:`BROWSER` to the value of one of the
1506+
supported browsers on macOS.
1507+
1508+
14521509
zipinfo
14531510
-------
14541511

Grammar/python.gram

+1
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,7 @@ invalid_elif_stmt:
14431443
invalid_else_stmt:
14441444
| a='else' ':' NEWLINE !INDENT {
14451445
RAISE_INDENTATION_ERROR("expected an indented block after 'else' statement on line %d", a->lineno) }
1446+
| 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR("'elif' block follows an 'else' block")}
14461447
invalid_while_stmt:
14471448
| 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
14481449
| a='while' named_expression ':' NEWLINE !INDENT {

Include/internal/pycore_opcode_metadata.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)