Skip to content

Commit 8d0400c

Browse files
authored
Merge branch 'main' into sslcontext-thread-safety-docs
2 parents 0948651 + 42351c3 commit 8d0400c

File tree

361 files changed

+6363
-2790
lines changed

Some content is hidden

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

361 files changed

+6363
-2790
lines changed

.github/CODEOWNERS

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

1414
# Build system
1515
configure* @erlend-aasland @corona10
16+
Makefile.pre.in @erlend-aasland
17+
Modules/Setup* @erlend-aasland
1618

1719
# asyncio
1820
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
@@ -34,11 +36,13 @@ Python/ceval*.h @markshannon
3436
Python/compile.c @markshannon @iritkatriel
3537
Python/assemble.c @markshannon @iritkatriel
3638
Python/flowgraph.c @markshannon @iritkatriel
39+
Python/instruction_sequence.c @iritkatriel
3740
Python/ast_opt.c @isidentical
3841
Python/bytecodes.c @markshannon
3942
Python/optimizer*.c @markshannon
4043
Python/optimizer_analysis.c @Fidget-Spinner
4144
Python/optimizer_bytecodes.c @Fidget-Spinner
45+
Python/symtable.c @JelleZijlstra @carljm
4246
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
4347
Lib/test/test_patma.py @brandtbucher
4448
Lib/test/test_type_*.py @JelleZijlstra
@@ -74,11 +78,8 @@ Programs/python.c @ericsnowcurrently
7478
Tools/build/generate_global_objects.py @ericsnowcurrently
7579

7680
# Exceptions
77-
Lib/traceback.py @iritkatriel
7881
Lib/test/test_except*.py @iritkatriel
79-
Lib/test/test_traceback.py @iritkatriel
8082
Objects/exceptions.c @iritkatriel
81-
Python/traceback.c @iritkatriel
8283

8384
# Hashing
8485
**/*hashlib* @gpshead @tiran
@@ -155,10 +156,10 @@ Include/internal/pycore_time.h @pganssle @abalkin
155156
/Tools/cases_generator/ @markshannon
156157

157158
# AST
158-
Python/ast.c @isidentical
159-
Parser/asdl.py @isidentical
160-
Parser/asdl_c.py @isidentical
161-
Lib/ast.py @isidentical
159+
Python/ast.c @isidentical @JelleZijlstra
160+
Parser/asdl.py @isidentical @JelleZijlstra
161+
Parser/asdl_c.py @isidentical @JelleZijlstra
162+
Lib/ast.py @isidentical @JelleZijlstra
162163

163164
# Mock
164165
/Lib/unittest/mock.py @cjw296
@@ -175,6 +176,10 @@ Lib/ast.py @isidentical
175176
/Lib/test/test_subprocess.py @gpshead
176177
/Modules/*subprocess* @gpshead
177178

179+
# debugger
180+
**/*pdb* @gaogaotiantian
181+
**/*bdb* @gaogaotiantian
182+
178183
# Limited C API & stable ABI
179184
Tools/build/stable_abi.py @encukou
180185
Misc/stable_abi.toml @encukou
@@ -242,7 +247,7 @@ Doc/howto/clinic.rst @erlend-aasland
242247
**/*interpreteridobject.* @ericsnowcurrently
243248
**/*crossinterp* @ericsnowcurrently
244249
Lib/test/support/interpreters/ @ericsnowcurrently
245-
Modules/_xx*interp*module.c @ericsnowcurrently
250+
Modules/_interp*module.c @ericsnowcurrently
246251
Lib/test/test_interpreters/ @ericsnowcurrently
247252

248253
# Android

.github/workflows/build.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
# into the PR branch anyway.
5555
#
5656
# https://github.com/python/core-workflow/issues/373
57-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
57+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$|\.md$|mypy\.ini$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
5858
fi
5959
6060
# Check if we should run hypothesis tests
@@ -199,8 +199,9 @@ jobs:
199199
uses: ./.github/workflows/reusable-macos.yml
200200
with:
201201
config_hash: ${{ needs.check_source.outputs.config_hash }}
202-
# macos-14 is M1, macos-13 is Intel
203-
os-matrix: '["macos-14", "macos-13"]'
202+
# Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
203+
# Cirrus used for upstream, macos-14 for forks.
204+
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14", "macos-13"]'
204205

205206
build_macos_free_threading:
206207
name: 'macOS (free-threading)'
@@ -210,8 +211,9 @@ jobs:
210211
with:
211212
config_hash: ${{ needs.check_source.outputs.config_hash }}
212213
free-threading: true
213-
# macos-14-large is Intel with 12 cores (most parallelism)
214-
os-matrix: '["macos-14"]'
214+
# Cirrus and macos-14 are M1.
215+
# Cirrus used for upstream, macos-14 for forks.
216+
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14"]'
215217

216218
build_ubuntu:
217219
name: 'Ubuntu'

.github/workflows/reusable-macos.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
jobs:
1616
build_macos:
17-
name: 'build and test'
17+
name: build and test (${{ matrix.os }})
1818
timeout-minutes: 60
1919
env:
2020
HOMEBREW_NO_ANALYTICS: 1
@@ -27,6 +27,13 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
os: ${{fromJson(inputs.os-matrix)}}
30+
is-fork:
31+
- ${{ github.repository_owner != 'python' }}
32+
exclude:
33+
- os: "ghcr.io/cirruslabs/macos-runner:sonoma"
34+
is-fork: true
35+
- os: "macos-14"
36+
is-fork: false
3037
runs-on: ${{ matrix.os }}
3138
steps:
3239
- uses: actions/checkout@v4

Doc/c-api/long.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,19 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
494494
.. versionadded:: 3.13
495495
496496
497+
.. c:function:: int PyLong_GetSign(PyObject *obj, int *sign)
498+
499+
Get the sign of the integer object *obj*.
500+
501+
On success, set *\*sign* to the integer sign (0, -1 or +1 for zero, negative or
502+
positive integer, respectively) and return 0.
503+
504+
On failure, return -1 with an exception set. This function always succeeds
505+
if *obj* is a :c:type:`PyLongObject` or its subtype.
506+
507+
.. versionadded:: 3.14
508+
509+
497510
.. c:function:: int PyUnstable_Long_IsCompact(const PyLongObject* op)
498511
499512
Return 1 if *op* is compact, 0 otherwise.

Doc/c-api/monitoring.rst

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

33
.. _monitoring:
44

5-
Monitorong C API
5+
Monitoring C API
66
================
77

88
Added in version 3.13.

Doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@
339339
html_context = {
340340
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
341341
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
342-
"pr_id": os.getenv("READTHEDOCS_VERSION")
342+
"pr_id": os.getenv("READTHEDOCS_VERSION"),
343+
"enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
343344
}
344345

345346
# This 'Last updated on:' timestamp is inserted at the bottom of every page.

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ Glossary
594594
therefore it is never deallocated.
595595

596596
Built-in strings and singletons are immortal objects. For example,
597-
:const:`True` and :const:`None` singletons are immmortal.
597+
:const:`True` and :const:`None` singletons are immortal.
598598

599599
See `PEP 683 – Immortal Objects, Using a Fixed Refcount
600600
<https://peps.python.org/pep-0683/>`_ for more information.

Doc/howto/descriptor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ Invocation from super
787787
---------------------
788788

789789
The logic for super's dotted lookup is in the :meth:`__getattribute__` method for
790-
object returned by :class:`super()`.
790+
object returned by :func:`super`.
791791

792792
A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__.__mro__``
793793
for the base class ``B`` immediately following ``A`` and then returns

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2950,7 +2950,7 @@ When run, this produces a file with exactly two lines:
29502950
.. code-block:: none
29512951
29522952
28/01/2015 07:21:23|INFO|Sample message|
2953-
28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by zero|'Traceback (most recent call last):\n File "logtest7.py", line 30, in main\n x = 1 / 0\nZeroDivisionError: integer division or modulo by zero'|
2953+
28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback (most recent call last):\n File "logtest7.py", line 30, in main\n x = 1 / 0\nZeroDivisionError: division by zero'|
29542954
29552955
While the above treatment is simplistic, it points the way to how exception
29562956
information can be formatted to your liking. The :mod:`traceback` module may be

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The class can be used to simulate nested scopes and is useful in templating.
9999
:func:`super` function. A reference to ``d.parents`` is equivalent to:
100100
``ChainMap(*d.maps[1:])``.
101101

102-
Note, the iteration order of a :class:`ChainMap()` is determined by
102+
Note, the iteration order of a :class:`ChainMap` is determined by
103103
scanning the mappings last to first::
104104

105105
>>> baseline = {'music': 'bach', 'art': 'rembrandt'}

Doc/library/contextlib.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ Functions and classes provided:
314314

315315
If the code within the :keyword:`!with` block raises a
316316
:exc:`BaseExceptionGroup`, suppressed exceptions are removed from the
317-
group. If any exceptions in the group are not suppressed, a group containing them is re-raised.
317+
group. Any exceptions of the group which are not suppressed are re-raised in
318+
a new group which is created using the original group's :meth:`~BaseExceptionGroup.derive`
319+
method.
318320

319321
.. versionadded:: 3.4
320322

Doc/library/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ There is one more :class:`tzinfo` method that a subclass may wish to override:
21532153

21542154
.. method:: tzinfo.fromutc(dt)
21552155

2156-
This is called from the default :class:`datetime.astimezone()`
2156+
This is called from the default :meth:`datetime.astimezone`
21572157
implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s
21582158
date and time data are to be viewed as expressing a UTC time. The purpose
21592159
of :meth:`fromutc` is to adjust the date and time data, returning an

Doc/library/decimal.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,48 @@ Decimal objects
897897
:const:`Rounded`. If given, applies *rounding*; otherwise, uses the
898898
rounding method in either the supplied *context* or the current context.
899899

900+
Decimal numbers can be rounded using the :func:`.round` function:
901+
902+
.. describe:: round(number)
903+
.. describe:: round(number, ndigits)
904+
905+
If *ndigits* is not given or ``None``,
906+
returns the nearest :class:`int` to *number*,
907+
rounding ties to even, and ignoring the rounding mode of the
908+
:class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an
909+
infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN.
910+
911+
If *ndigits* is an :class:`int`, the context's rounding mode is respected
912+
and a :class:`Decimal` representing *number* rounded to the nearest
913+
multiple of ``Decimal('1E-ndigits')`` is returned; in this case,
914+
``round(number, ndigits)`` is equivalent to
915+
``self.quantize(Decimal('1E-ndigits'))``. Returns ``Decimal('NaN')`` if
916+
*number* is a quiet NaN. Raises :class:`InvalidOperation` if *number*
917+
is an infinity, a signaling NaN, or if the length of the coefficient after
918+
the quantize operation would be greater than the current context's
919+
precision. In other words, for the non-corner cases:
920+
921+
* if *ndigits* is positive, return *number* rounded to *ndigits* decimal
922+
places;
923+
* if *ndigits* is zero, return *number* rounded to the nearest integer;
924+
* if *ndigits* is negative, return *number* rounded to the nearest
925+
multiple of ``10**abs(ndigits)``.
926+
927+
For example::
928+
929+
>>> from decimal import Decimal, getcontext, ROUND_DOWN
930+
>>> getcontext().rounding = ROUND_DOWN
931+
>>> round(Decimal('3.75')) # context rounding ignored
932+
4
933+
>>> round(Decimal('3.5')) # round-ties-to-even
934+
4
935+
>>> round(Decimal('3.75'), 0) # uses the context rounding
936+
Decimal('3')
937+
>>> round(Decimal('3.75'), 1)
938+
Decimal('3.7')
939+
>>> round(Decimal('3.75'), -1)
940+
Decimal('0E+1')
941+
900942

901943
.. _logical_operands_label:
902944

Doc/library/dis.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,10 @@ operation is being performed, so the intermediate analysis object isn't useful:
336336
Added the *show_caches* and *adaptive* parameters.
337337

338338
.. versionchanged:: 3.13
339-
The *show_caches* parameter is deprecated and has no effect. The *cache_info*
340-
field of each instruction is populated regardless of its value.
341-
339+
The *show_caches* parameter is deprecated and has no effect. The iterator
340+
generates the :class:`Instruction` instances with the *cache_info*
341+
field populated (regardless of the value of *show_caches*) and it no longer
342+
generates separate items for the cache entries.
342343

343344
.. function:: findlinestarts(code)
344345

@@ -1666,7 +1667,7 @@ iterations of the loop.
16661667

16671668
A no-op. Performs internal tracing, debugging and optimization checks.
16681669

1669-
The ``context`` oparand consists of two parts. The lowest two bits
1670+
The ``context`` operand consists of two parts. The lowest two bits
16701671
indicate where the ``RESUME`` occurs:
16711672

16721673
* ``0`` The start of a function, which is neither a generator, coroutine

Doc/library/email.header.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Here is the :class:`Header` class description:
7777
The maximum line length can be specified explicitly via *maxlinelen*. For
7878
splitting the first line to a shorter value (to account for the field header
7979
which isn't included in *s*, e.g. :mailheader:`Subject`) pass in the name of the
80-
field in *header_name*. The default *maxlinelen* is 76, and the default value
80+
field in *header_name*. The default *maxlinelen* is 78, and the default value
8181
for *header_name* is ``None``, meaning it is not taken into account for the
8282
first line of a long, split header.
8383

Doc/library/exceptions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ their subgroups based on the types of the contained exceptions.
989989
Returns an exception group with the same :attr:`message`, but which
990990
wraps the exceptions in ``excs``.
991991

992-
This method is used by :meth:`subgroup` and :meth:`split`. A
992+
This method is used by :meth:`subgroup` and :meth:`split`, which
993+
are used in various contexts to break up an exception group. A
993994
subclass needs to override it in order to make :meth:`subgroup`
994995
and :meth:`split` return instances of the subclass rather
995996
than :exc:`ExceptionGroup`.

Doc/library/fileinput.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Lines are returned with any newlines intact, which means that the last line in
4747
a file may not have one.
4848

4949
You can control how files are opened by providing an opening hook via the
50-
*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The
50+
*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The
5151
hook must be a function that takes two arguments, *filename* and *mode*, and
5252
returns an accordingly opened file-like object. If *encoding* and/or *errors*
5353
are specified, they will be passed to the hook as additional keyword arguments.

Doc/library/functions.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,9 @@ are always available. They are listed here in alphabetical order.
15611561
returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative base of
15621562
type :class:`int` or :class:`float` and a non-integral exponent, a complex
15631563
result is delivered. For example, ``pow(-9, 0.5)`` returns a value close
1564-
to ``3j``.
1564+
to ``3j``. Whereas, for a negative base of type :class:`int` or :class:`float`
1565+
with an integral exponent, a float result is delivered. For example,
1566+
``pow(-9, 2.0)`` returns ``81.0``.
15651567

15661568
For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must
15671569
also be of integer type and *mod* must be nonzero. If *mod* is present and

Doc/library/ipaddress.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ The module also provides the following module level functions:
990990
.. function:: collapse_addresses(addresses)
991991

992992
Return an iterator of the collapsed :class:`IPv4Network` or
993-
:class:`IPv6Network` objects. *addresses* is an iterator of
993+
:class:`IPv6Network` objects. *addresses* is an :term:`iterable` of
994994
:class:`IPv4Network` or :class:`IPv6Network` objects. A :exc:`TypeError` is
995995
raised if *addresses* contains mixed version objects.
996996

Doc/library/multiprocessing.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ For an example of the usage of queues for interprocess communication see
837837
Return ``True`` if the queue is empty, ``False`` otherwise. Because of
838838
multithreading/multiprocessing semantics, this is not reliable.
839839

840+
May raise an :exc:`OSError` on closed queues. (not guaranteed)
841+
840842
.. method:: full()
841843

842844
Return ``True`` if the queue is full, ``False`` otherwise. Because of
@@ -940,6 +942,8 @@ For an example of the usage of queues for interprocess communication see
940942

941943
Return ``True`` if the queue is empty, ``False`` otherwise.
942944

945+
Always raises an :exc:`OSError` if the SimpleQueue is closed.
946+
943947
.. method:: get()
944948

945949
Remove and return an item from the queue.

Doc/library/os.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ process and user.
193193
to the environment made after this time are not reflected in :data:`os.environ`,
194194
except for changes made by modifying :data:`os.environ` directly.
195195

196+
The :meth:`!os.environ.refresh()` method updates :data:`os.environ` with
197+
changes to the environment made by :func:`os.putenv`, by
198+
:func:`os.unsetenv`, or made outside Python in the same process.
199+
196200
This mapping may be used to modify the environment as well as query the
197201
environment. :func:`putenv` will be called automatically when the mapping
198202
is modified.
@@ -225,6 +229,9 @@ process and user.
225229
.. versionchanged:: 3.9
226230
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators.
227231

232+
.. versionchanged:: 3.14
233+
Added the :meth:`!os.environ.refresh()` method.
234+
228235

229236
.. data:: environb
230237

@@ -561,6 +568,8 @@ process and user.
561568
of :data:`os.environ`. This also applies to :func:`getenv` and :func:`getenvb`, which
562569
respectively use :data:`os.environ` and :data:`os.environb` in their implementations.
563570

571+
See also the :data:`os.environ.refresh() <os.environ>` method.
572+
564573
.. note::
565574

566575
On some platforms, including FreeBSD and macOS, setting ``environ`` may
@@ -809,6 +818,8 @@ process and user.
809818
don't update :data:`os.environ`, so it is actually preferable to delete items of
810819
:data:`os.environ`.
811820

821+
See also the :data:`os.environ.refresh() <os.environ>` method.
822+
812823
.. audit-event:: os.unsetenv key os.unsetenv
813824

814825
.. versionchanged:: 3.9

0 commit comments

Comments
 (0)