Skip to content

Commit a6bb0a4

Browse files
authored
Merge branch 'main' into io-managed-weakref
2 parents 97a77b7 + c8eabcc commit a6bb0a4

382 files changed

Lines changed: 8955 additions & 2791 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: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,12 @@ Lib/_osx_support.py @python/macos-team
172172
Lib/test/test__osx_support.py @python/macos-team
173173

174174
# WebAssembly (Emscripten)
175-
Platforms/emscripten @freakboy3742 @emmatyping
176-
Tools/wasm/emscripten @freakboy3742 @emmatyping
175+
Platforms/emscripten @freakboy3742 @emmatyping @hoodmane
176+
Tools/wasm/emscripten @freakboy3742 @emmatyping @hoodmane
177+
Python/wasm_trampoline.c @hoodmane
178+
Python/emscripten_signal.c @hoodmane
179+
Python/emscripten_syscalls.c @hoodmane
180+
.github/workflows/reusable-emscripten.yml @hoodmane
177181

178182
# WebAssembly (WASI)
179183
Platforms/WASI @brettcannon @emmatyping @savannahostrowski
@@ -510,6 +514,13 @@ Doc/library/importlib.resources.rst @jaraco @warsaw @FFY00
510514
Lib/importlib/resources/ @jaraco @warsaw @FFY00
511515
Lib/test/test_importlib/resources/ @jaraco @warsaw @FFY00
512516

517+
# IO
518+
Doc/library/io.rst @cmaloney
519+
Lib/_pyio.py @cmaloney
520+
Lib/io.py @cmaloney
521+
Lib/test/test_io/ @cmaloney
522+
Modules/_io/ @cmaloney
523+
513524
# Itertools
514525
Doc/library/itertools.rst @rhettinger
515526
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"

‎.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/functions.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ are always available. They are listed here in alphabetical order.
19501950
>>> MISSING
19511951
<MISSING>
19521952

1953-
Sentinel objects are truthy and compare equal only to themselves. They are
1953+
Sentinel objects are true and compare equal only to themselves. They are
19541954
intended to be compared with the :keyword:`is` operator.
19551955

19561956
``sentinel`` does not support subclassing.

‎Doc/builtins/stdtypes.rst‎

Lines changed: 12 additions & 2 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, /)

‎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/code.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ bound into a function.
4444
The old name is deprecated, but will remain available until the
4545
signature changes again.
4646
47+
.. c:function:: PyObject* PyUnstable_Code_GetLocalPlusNames(PyCodeObject *co)
48+
49+
Return a :term:`strong reference` to a tuple of names of the local, cell and
50+
free variables of a code object. The names are in the same order as the
51+
values returned by :c:func:`PyUnstable_InterpreterFrame_GetLocal`.
52+
53+
.. versionadded:: next
54+
4755
.. c:function:: PyCodeObject* PyUnstable_Code_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, PyObject *qualname, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
4856
4957
Return a new code object. If you need a dummy code object to create a frame,

‎Doc/c-api/dict.rst‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,29 @@ Dictionary objects
507507
modified by another thread.
508508
509509
510+
.. c:function:: PyObject* PyDict_AsFrozenDictAndClear(PyObject *dict)
511+
512+
Return a new :class:`frozendict` created
513+
from the existing :class:`dict` instance.
514+
515+
Transfers all keys and values from *dict*
516+
to the newly allocated :class:`!frozendict`.
517+
Clears the input *dict* on success.
518+
Returns ``NULL`` with the exception set on error.
519+
520+
This function is intended for building a :class:`!frozendict` instance via
521+
a temporary *dict* that is not exposed to user code.
522+
To "freeze" an arbitrary dictionary, for example one received from the user
523+
as an argument, prefer :c:func:`PyFrozenDict_New` to leave the source
524+
intact.
525+
526+
.. impl-detail::
527+
528+
Works with O(1) complexity.
529+
530+
.. versionadded:: next
531+
532+
510533
.. c:function:: int PyDict_AddWatcher(PyDict_WatchCallback callback)
511534
512535
Register *callback* as a dictionary watcher. Return a non-negative integer

‎Doc/c-api/frame.rst‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ See also :ref:`Reflection <reflection>`.
9999
100100
Get the *frame*'s :attr:`~frame.f_lasti` attribute.
101101
102-
Returns -1 if ``frame.f_lasti`` is ``None``.
103-
104102
.. versionadded:: 3.11
105103
106104
@@ -243,3 +241,21 @@ Unless using :pep:`523`, you will not need this.
243241
Return the currently executing line number, or -1 if there is no line number.
244242
245243
.. versionadded:: 3.12
244+
245+
246+
.. c:function:: int PyUnstable_InterpreterFrame_GetLocal(struct _PyInterpreterFrame *frame, Py_ssize_t index, PyObject **result)
247+
248+
Retrieve the local variable at *index*.
249+
To determine the index of a particular variable, use
250+
:c:func:`PyUnstable_InterpreterFrame_GetCode` and
251+
:c:func:`PyUnstable_Code_GetLocalPlusNames`.
252+
253+
Cell and free variables are unboxed to their contents. Free variables are
254+
resolved from the function closure, so this also works on a frame that has
255+
not started executing.
256+
257+
* On success, store a new :term:`strong reference` in *result* and return ``1``.
258+
* If the slot is unset or hidden, store ``NULL`` in *result* and return ``0``.
259+
* On error, raise an exception, store ``NULL`` in *result* and return ``-1``.
260+
261+
.. versionadded:: next

‎Doc/c-api/gcsupport.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ rules:
4242
.. warning::
4343
If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least
4444
a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one
45-
from its subclass or subclasses.
45+
from a base class.
4646

4747
When calling :c:func:`PyType_Ready` or some of the APIs that indirectly
4848
call it like :c:func:`PyType_FromSpecWithBases` or

0 commit comments

Comments
 (0)