Skip to content

Commit 9b9c5ca

Browse files
authored
Merge branch 'main' into issue-105578
2 parents adfaf3d + 2ac2b93 commit 9b9c5ca

516 files changed

Lines changed: 11433 additions & 3039 deletions

File tree

Some content is hidden

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

‎.github/CODEOWNERS‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ Lib/test/test_*time.py @pganssle @StanFromIreland
432432
Modules/*zoneinfo* @pganssle @StanFromIreland
433433
Modules/*time* @pganssle @StanFromIreland
434434
Python/pytime.c @pganssle @StanFromIreland
435+
Python/_strptime.c @pganssle @StanFromIreland
435436

436437
# Dbm
437438
Doc/library/dbm.rst @corona10 @erlend-aasland @serhiy-storchaka
@@ -509,6 +510,13 @@ Doc/library/importlib.resources.rst @jaraco @warsaw @FFY00
509510
Lib/importlib/resources/ @jaraco @warsaw @FFY00
510511
Lib/test/test_importlib/resources/ @jaraco @warsaw @FFY00
511512

513+
# IO
514+
Doc/library/io.rst @cmaloney
515+
Lib/_pyio.py @cmaloney
516+
Lib/io.py @cmaloney
517+
Lib/test/test_io/ @cmaloney
518+
Modules/_io/ @cmaloney
519+
512520
# Itertools
513521
Doc/library/itertools.rst @rhettinger
514522
Lib/test/test_itertools.py @rhettinger

‎.github/workflows/reusable-emscripten.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
f.write(f"node-version={config['node-version']}\n")
4040
f.write(f"deps-hash={h.hexdigest()}\n")
4141
with open(os.environ["GITHUB_ENV"], "a") as f:
42-
f.write(f"EMSDK_CACHE={emsdk_cache}\n")
42+
f.write(f"PY_EMSDK_CACHE={emsdk_cache}\n")
4343
- name: "Install Node.js"
4444
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
4545
with:
@@ -48,7 +48,7 @@ jobs:
4848
id: emsdk-cache
4949
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
5050
with:
51-
path: ${{ env.EMSDK_CACHE }}
51+
path: ${{ env.PY_EMSDK_CACHE }}
5252
key: emsdk-${{ steps.emscripten-config.outputs.emscripten-version }}-${{ steps.emscripten-config.outputs.deps-hash }}
5353
restore-keys: emsdk-${{ steps.emscripten-config.outputs.emscripten-version }}
5454
- name: "Install Python"

‎.github/workflows/reusable-macos.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
--enable-slower-safety \
5252
--enable-safety \
5353
${{ inputs.free-threading && '--disable-gil' || '' }} \
54+
--with-tail-call-interp \
5455
--prefix=/opt/python-dev \
5556
--with-openssl="$(brew --prefix openssl@3.5)"
5657
- name: Build CPython

‎.github/workflows/tail-call.yml‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,6 @@ env:
2323
LLVM_VERSION: 21
2424

2525
jobs:
26-
macos:
27-
name: aarch64-apple-darwin/clang
28-
runs-on: macos-26
29-
timeout-minutes: 60
30-
steps:
31-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32-
with:
33-
persist-credentials: false
34-
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
35-
with:
36-
python-version: '3.11'
37-
- name: Install dependencies
38-
run: |
39-
brew update
40-
brew install llvm@${{ env.LLVM_VERSION }}
41-
- name: Build
42-
run: |
43-
export SDKROOT="$(xcrun --show-sdk-path)"
44-
export PATH="/opt/homebrew/opt/llvm@${{ env.LLVM_VERSION }}/bin:$PATH"
45-
CC=clang-${{ env.LLVM_VERSION }} ./configure --with-tail-call-interp
46-
make all --jobs 4
47-
- name: Test
48-
run: |
49-
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
50-
5126
linux:
5227
name: ${{ matrix.target }}
5328
runs-on: ${{ matrix.runner }}

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*.pyo
2121
*.rej
2222
*.swp
23+
*.pickle
2324
*~
2425
*.gc??
2526
*.profclang?

‎Doc/builtins/exceptions.rst‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,9 @@ The following exceptions are the exceptions that are usually raised.
396396

397397
.. attribute:: strerror
398398

399-
The corresponding error message, as provided by
400-
the operating system. It is formatted by the C
401-
functions :c:func:`!perror` under POSIX, and :c:func:`!FormatMessage`
402-
under Windows.
399+
The corresponding error message, as provided by the operating system.
400+
Under POSIX, it is obtained using the C functions :c:func:`!strerror`
401+
or :c:func:`!strerror_r`; under Windows, :c:func:`!FormatMessage` is used.
403402

404403
.. attribute:: filename
405404
filename2
@@ -567,11 +566,6 @@ The following exceptions are the exceptions that are usually raised.
567566
The column in the end line where the error occurred finishes. This is
568567
1-indexed: the first character in the line has an ``offset`` of 1.
569568

570-
For errors in f-string fields, the message is prefixed by "f-string: "
571-
and the offsets are offsets in a text constructed from the replacement
572-
expression. For example, compiling f'Bad {a b} field' results in this
573-
args attribute: ('f-string: ...', ('', 1, 2, '(a b)\n', 1, 5)).
574-
575569
.. versionchanged:: 3.10
576570
Added the :attr:`end_lineno` and :attr:`end_offset` attributes.
577571

‎Doc/builtins/functions.rst‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ are always available. They are listed here in alphabetical order.
772772
still access all builtins.
773773

774774
The *closure* argument specifies a closure--a tuple of cellvars.
775-
It's only valid when the *object* is a code object containing
775+
It's only valid when *source* is a code object containing
776776
:term:`free (closure) variables <closure variable>`.
777777
The length of the tuple must exactly match the length of the code object's
778778
:attr:`~codeobject.co_freevars` attribute.
@@ -1853,8 +1853,6 @@ are always available. They are listed here in alphabetical order.
18531853
including the name and address of the object. A class can control what this
18541854
function returns for its instances
18551855
by defining a :meth:`~object.__repr__` method.
1856-
If :func:`sys.displayhook` is not accessible, this function will raise
1857-
:exc:`RuntimeError`.
18581856

18591857
This class has a custom representation that can be evaluated::
18601858

@@ -2168,10 +2166,10 @@ are always available. They are listed here in alphabetical order.
21682166

21692167
When called directly within an ordinary method of a class, both arguments may
21702168
be omitted ("zero-argument :func:`!super`"). In this case, *type* will be the
2171-
enclosing class, and *obj* will be the first argument of the immediately
2172-
enclosing function (typically ``self``). (This means that zero-argument
2169+
enclosing class, and *object_or_type* will be the first argument of the
2170+
immediately enclosing function (typically ``self``). Zero-argument
21732171
:func:`!super` will not work as expected within nested functions, including
2174-
generator expressions, which implicitly create nested functions.)
2172+
generator expressions, which implicitly create nested functions.
21752173

21762174
There are two typical use cases for *super*. In a class hierarchy with
21772175
single inheritance, *super* can be used to refer to parent classes without
@@ -2430,10 +2428,9 @@ are always available. They are listed here in alphabetical order.
24302428
determine the package context of the :keyword:`import` statement.
24312429

24322430
*level* specifies whether to use absolute or relative imports. ``0`` (the
2433-
default) means only perform absolute imports. Positive values for
2434-
*level* indicate the number of parent directories to search relative to the
2435-
directory of the module calling :func:`__import__` (see :pep:`328` for the
2436-
details).
2431+
default) means only perform absolute imports. For relative imports,
2432+
``1`` refers to the current package, ``2`` to its parent package, and so on
2433+
(see :pep:`328` for details).
24372434

24382435
When the *name* variable is of the form ``package.module``, normally, the
24392436
top-level package (the name up till the first dot) is returned, *not* the

‎Doc/builtins/stdtypes.rst‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,13 +2129,23 @@ expression support in the :mod:`re` module).
21292129
.. method:: str.capitalize()
21302130

21312131
Return a copy of the string with its first character capitalized and the
2132-
rest lowercased.
2132+
rest lowercased. For example:
2133+
2134+
.. doctest::
2135+
2136+
>>> 'PYTHON IS AMAZING'.capitalize()
2137+
'Python is amazing'
2138+
>>> 'Njemačka starts With a non-ASCII digraph'.capitalize()
2139+
'Njemačka starts with a non-ascii digraph'
2140+
2141+
See also :meth:`title`.
21332142

21342143
.. versionchanged:: 3.8
21352144
The first character is now put into titlecase rather than uppercase.
21362145
This means that characters like digraphs will only have their first
21372146
letter capitalized, instead of the full character.
21382147

2148+
21392149
.. method:: str.casefold()
21402150

21412151
Return a casefolded copy of the string. Casefolded strings may be used for
@@ -3137,7 +3147,7 @@ expression support in the :mod:`re` module).
31373147
>>> titlecase("they're bill's friends.")
31383148
"They're Bill's Friends."
31393149

3140-
See also :meth:`istitle`.
3150+
See also :meth:`istitle` and :meth:`capitalize`.
31413151

31423152

31433153
.. method:: str.translate(table, /)
@@ -3780,8 +3790,8 @@ objects.
37803790

37813791
If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated.
37823792

3783-
If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*,
3784-
will be set to null bytes.
3793+
If the :class:`bytearray` needs to grow, all new bytes will be set to null
3794+
bytes.
37853795

37863796

37873797
This is equivalent to:
@@ -5616,9 +5626,8 @@ Note, the non-operator versions of the :meth:`~set.update`,
56165626
argument.
56175627

56185628
Note, the *elem* argument to the :meth:`~object.__contains__`,
5619-
:meth:`~set.remove`, and
5620-
:meth:`~set.discard` methods may be a set. To support searching for an equivalent
5621-
frozenset, a temporary one is created from *elem*.
5629+
:meth:`~set.remove`, and :meth:`~set.discard` methods may be a set. In this case,
5630+
an equivalent frozenset is searched for.
56225631

56235632
Sets and frozensets are :ref:`generic <generics>` over the type of their elements.
56245633

@@ -5668,7 +5677,7 @@ can be used interchangeably to index the same dictionary entry.
56685677

56695678
* Use a comma-separated list of ``key: value`` pairs within braces:
56705679
``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``
5671-
* Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``
5680+
* Use a dict comprehension: ``{x: x ** 2 for x in range(10)}``
56725681
* Use the type constructor: ``dict()``,
56735682
``dict([('foo', 100), ('bar', 200)])``, ``dict(foo=100, bar=200)``
56745683

@@ -5879,9 +5888,8 @@ can be used interchangeably to index the same dictionary entry.
58795888
Return a new view of the dictionary's values. See the
58805889
:ref:`documentation of view objects <dict-views>`.
58815890

5882-
An equality comparison between one ``dict.values()`` view and another
5883-
will always return ``False``. This also applies when comparing
5884-
``dict.values()`` to itself::
5891+
An equality comparison between two distinct ``dict.values()`` views
5892+
will always return ``False``, even for views of the same dictionary::
58855893

58865894
>>> d = {'a': 1}
58875895
>>> d.values() == d.values()

‎Doc/builtins/threadsafety.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,13 @@ underlying object supports it:
604604
Resizing or reallocating the underlying object (such as calling
605605
:meth:`bytearray.resize`) while a memoryview is exported raises
606606
:exc:`BufferError`. This is enforced regardless of threading.
607+
608+
In the :term:`free-threaded build`, :meth:`~memoryview.release` is
609+
thread-safe. If another thread has an in-flight operation on the memoryview
610+
when it is released, the underlying buffer may remain exported until that
611+
operation completes. Restrictions on the exporter, such as prohibiting
612+
resizing, remain in effect until then.
613+
614+
For read-heavy workloads that share an underlying object across threads,
615+
creating a separate memoryview of that object in each thread may improve
616+
performance.

‎Doc/c-api/bool.rst‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ are available, however.
2525
2626
.. c:var:: PyObject* Py_False
2727
28-
The Python ``False`` object. This object has no methods and is
29-
:term:`immortal`.
28+
The Python ``False`` object. This object is :term:`immortal`.
3029
3130
.. versionchanged:: 3.12
3231
:c:data:`Py_False` is :term:`immortal`.
3332
3433
3534
.. c:var:: PyObject* Py_True
3635
37-
The Python ``True`` object. This object has no methods and is
38-
:term:`immortal`.
36+
The Python ``True`` object. This object is :term:`immortal`.
3937
4038
.. versionchanged:: 3.12
4139
:c:data:`Py_True` is :term:`immortal`.

0 commit comments

Comments
 (0)