Skip to content

Commit cf23fcd

Browse files
committed
Merge branch 'main' of https://github.com/python/cpython
2 parents 7cfeb8c + 347d359 commit cf23fcd

36 files changed

+489
-253
lines changed

Doc/c-api/object.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,3 +801,20 @@ Object Protocol
801801
cannot fail.
802802
803803
.. versionadded:: 3.14
804+
805+
.. c:function:: int PyUnstable_SetImmortal(PyObject *op)
806+
807+
Marks the object *op* :term:`immortal`. The argument should be uniquely referenced by
808+
the calling thread. This is intended to be used for reducing reference counting contention
809+
in the :term:`free-threaded build` for objects which are shared across threads.
810+
811+
This is a one-way process: objects can only be made immortal; they cannot be
812+
made mortal once again. Immortal objects do not participate in reference counting
813+
and will never be garbage collected. If the object is GC-tracked, it is untracked.
814+
815+
This function is intended to be used soon after *op* is created, by the code that
816+
creates it, such as in the object's :c:member:`~PyTypeObject.tp_new` slot.
817+
Returns 1 if the object was made immortal and returns 0 if it was not.
818+
This function cannot fail.
819+
820+
.. versionadded:: next

Doc/glossary.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,16 @@ Glossary
951951
to locks exist such as queues, producer/consumer patterns, and
952952
thread-local state. See also :term:`deadlock`, and :term:`reentrant`.
953953

954+
lock-free
955+
An operation that does not acquire any :term:`lock` and uses atomic CPU
956+
instructions to ensure correctness. Lock-free operations can execute
957+
concurrently without blocking each other and cannot be blocked by
958+
operations that hold locks. In :term:`free-threaded <free threading>`
959+
Python, built-in types like :class:`dict` and :class:`list` provide
960+
lock-free read operations, which means other threads may observe
961+
intermediate states during multi-step modifications even when those
962+
modifications hold the :term:`per-object lock`.
963+
954964
loader
955965
An object that loads a module.
956966
It must define the :meth:`!exec_module` and :meth:`!create_module` methods
@@ -1217,6 +1227,16 @@ Glossary
12171227
<faq-argument-vs-parameter>`, the :class:`inspect.Parameter` class, the
12181228
:ref:`function` section, and :pep:`362`.
12191229

1230+
per-object lock
1231+
A :term:`lock` associated with an individual object instance rather than
1232+
a global lock shared across all objects. In :term:`free-threaded
1233+
<free threading>` Python, built-in types like :class:`dict` and
1234+
:class:`list` use per-object locks to allow concurrent operations on
1235+
different objects while serializing operations on the same object.
1236+
Operations that hold the per-object lock prevent other locking operations
1237+
on the same object from proceeding, but do not block :term:`lock-free`
1238+
operations.
1239+
12201240
path entry
12211241
A single location on the :term:`import path` which the :term:`path
12221242
based finder` consults to find modules for importing.

Doc/library/codecs.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,8 +1551,8 @@ mapping. It is not supported by :meth:`str.encode` (which only produces
15511551
Restoration of the ``rot13`` alias.
15521552

15531553

1554-
:mod:`encodings` --- Encodings package
1555-
--------------------------------------
1554+
:mod:`!encodings` --- Encodings package
1555+
---------------------------------------
15561556

15571557
.. module:: encodings
15581558
:synopsis: Encodings package
@@ -1611,8 +1611,8 @@ This module implements the following exception:
16111611
Raised when a codec is invalid or incompatible.
16121612

16131613

1614-
:mod:`encodings.idna` --- Internationalized Domain Names in Applications
1615-
------------------------------------------------------------------------
1614+
:mod:`!encodings.idna` --- Internationalized Domain Names in Applications
1615+
-------------------------------------------------------------------------
16161616

16171617
.. module:: encodings.idna
16181618
:synopsis: Internationalized Domain Names implementation
@@ -1654,7 +1654,7 @@ When receiving host names from the wire (such as in reverse name lookup), no
16541654
automatic conversion to Unicode is performed: applications wishing to present
16551655
such host names to the user should decode them to Unicode.
16561656

1657-
The module :mod:`encodings.idna` also implements the nameprep procedure, which
1657+
The module :mod:`!encodings.idna` also implements the nameprep procedure, which
16581658
performs certain normalizations on host names, to achieve case-insensitivity of
16591659
international domain names, and to unify similar characters. The nameprep
16601660
functions can be used directly if desired.
@@ -1677,8 +1677,8 @@ functions can be used directly if desired.
16771677
Convert a label to Unicode, as specified in :rfc:`3490`.
16781678

16791679

1680-
:mod:`encodings.mbcs` --- Windows ANSI codepage
1681-
-----------------------------------------------
1680+
:mod:`!encodings.mbcs` --- Windows ANSI codepage
1681+
------------------------------------------------
16821682

16831683
.. module:: encodings.mbcs
16841684
:synopsis: Windows ANSI codepage
@@ -1695,8 +1695,8 @@ This module implements the ANSI codepage (CP_ACP).
16951695
Support any error handler.
16961696

16971697

1698-
:mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature
1699-
-------------------------------------------------------------
1698+
:mod:`!encodings.utf_8_sig` --- UTF-8 codec with BOM signature
1699+
--------------------------------------------------------------
17001700

17011701
.. module:: encodings.utf_8_sig
17021702
:synopsis: UTF-8 codec with BOM signature

Doc/library/curses.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,22 +1824,22 @@ The following table lists the predefined colors:
18241824
+-------------------------+----------------------------+
18251825

18261826

1827-
:mod:`curses.textpad` --- Text input widget for curses programs
1828-
===============================================================
1827+
:mod:`!curses.textpad` --- Text input widget for curses programs
1828+
================================================================
18291829

18301830
.. module:: curses.textpad
18311831
:synopsis: Emacs-like input editing in a curses window.
18321832
.. moduleauthor:: Eric Raymond <esr@thyrsus.com>
18331833
.. sectionauthor:: Eric Raymond <esr@thyrsus.com>
18341834

18351835

1836-
The :mod:`curses.textpad` module provides a :class:`Textbox` class that handles
1836+
The :mod:`!curses.textpad` module provides a :class:`Textbox` class that handles
18371837
elementary text editing in a curses window, supporting a set of keybindings
18381838
resembling those of Emacs (thus, also of Netscape Navigator, BBedit 6.x,
18391839
FrameMaker, and many other programs). The module also provides a
18401840
rectangle-drawing function useful for framing text boxes or for other purposes.
18411841

1842-
The module :mod:`curses.textpad` defines the following function:
1842+
The module :mod:`!curses.textpad` defines the following function:
18431843

18441844

18451845
.. function:: rectangle(win, uly, ulx, lry, lrx)

Doc/library/dbm.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ then prints out the contents of the database::
157157

158158
The individual submodules are described in the following sections.
159159

160-
:mod:`dbm.sqlite3` --- SQLite backend for dbm
161-
---------------------------------------------
160+
:mod:`!dbm.sqlite3` --- SQLite backend for dbm
161+
----------------------------------------------
162162

163163
.. module:: dbm.sqlite3
164164
:platform: All
@@ -172,7 +172,7 @@ The individual submodules are described in the following sections.
172172

173173
This module uses the standard library :mod:`sqlite3` module to provide an
174174
SQLite backend for the :mod:`!dbm` module.
175-
The files created by :mod:`dbm.sqlite3` can thus be opened by :mod:`sqlite3`,
175+
The files created by :mod:`!dbm.sqlite3` can thus be opened by :mod:`sqlite3`,
176176
or any other SQLite browser, including the SQLite CLI.
177177

178178
.. include:: ../includes/wasm-notavail.rst
@@ -220,8 +220,8 @@ or any other SQLite browser, including the SQLite CLI.
220220
.. versionadded:: 3.15
221221

222222

223-
:mod:`dbm.gnu` --- GNU database manager
224-
---------------------------------------
223+
:mod:`!dbm.gnu` --- GNU database manager
224+
----------------------------------------
225225

226226
.. module:: dbm.gnu
227227
:platform: Unix
@@ -231,20 +231,20 @@ or any other SQLite browser, including the SQLite CLI.
231231

232232
--------------
233233

234-
The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU dbm)`
234+
The :mod:`!dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU dbm)`
235235
library, similar to the :mod:`dbm.ndbm` module, but with additional
236236
functionality like crash tolerance.
237237

238238
.. note::
239239

240-
The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are incompatible
240+
The file formats created by :mod:`!dbm.gnu` and :mod:`dbm.ndbm` are incompatible
241241
and can not be used interchangeably.
242242

243243
.. include:: ../includes/wasm-mobile-notavail.rst
244244

245245
.. exception:: error
246246

247-
Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:`KeyError` is
247+
Raised on :mod:`!dbm.gnu`-specific errors, such as I/O errors. :exc:`KeyError` is
248248
raised for general mapping errors like specifying an incorrect key.
249249

250250

@@ -343,8 +343,8 @@ functionality like crash tolerance.
343343
unwritten data to be written to the disk.
344344

345345

346-
:mod:`dbm.ndbm` --- New Database Manager
347-
----------------------------------------
346+
:mod:`!dbm.ndbm` --- New Database Manager
347+
-----------------------------------------
348348

349349
.. module:: dbm.ndbm
350350
:platform: Unix
@@ -354,14 +354,14 @@ functionality like crash tolerance.
354354

355355
--------------
356356

357-
The :mod:`dbm.ndbm` module provides an interface to the
357+
The :mod:`!dbm.ndbm` module provides an interface to the
358358
:abbr:`NDBM (New Database Manager)` library.
359359
This module can be used with the "classic" NDBM interface or the
360360
:abbr:`GDBM (GNU dbm)` compatibility interface.
361361

362362
.. note::
363363

364-
The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are incompatible
364+
The file formats created by :mod:`dbm.gnu` and :mod:`!dbm.ndbm` are incompatible
365365
and can not be used interchangeably.
366366

367367
.. warning::
@@ -375,7 +375,7 @@ This module can be used with the "classic" NDBM interface or the
375375

376376
.. exception:: error
377377

378-
Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:`KeyError` is raised
378+
Raised on :mod:`!dbm.ndbm`-specific errors, such as I/O errors. :exc:`KeyError` is raised
379379
for general mapping errors like specifying an incorrect key.
380380

381381

@@ -425,8 +425,8 @@ This module can be used with the "classic" NDBM interface or the
425425
Close the NDBM database.
426426

427427

428-
:mod:`dbm.dumb` --- Portable DBM implementation
429-
-----------------------------------------------
428+
:mod:`!dbm.dumb` --- Portable DBM implementation
429+
------------------------------------------------
430430

431431
.. module:: dbm.dumb
432432
:synopsis: Portable implementation of the simple DBM interface.
@@ -437,14 +437,14 @@ This module can be used with the "classic" NDBM interface or the
437437

438438
.. note::
439439

440-
The :mod:`dbm.dumb` module is intended as a last resort fallback for the
441-
:mod:`!dbm` module when a more robust module is not available. The :mod:`dbm.dumb`
440+
The :mod:`!dbm.dumb` module is intended as a last resort fallback for the
441+
:mod:`!dbm` module when a more robust module is not available. The :mod:`!dbm.dumb`
442442
module is not written for speed and is not nearly as heavily used as the other
443443
database modules.
444444

445445
--------------
446446

447-
The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like
447+
The :mod:`!dbm.dumb` module provides a persistent :class:`dict`-like
448448
interface which is written entirely in Python.
449449
Unlike other :mod:`!dbm` backends, such as :mod:`dbm.gnu`, no
450450
external library is required.
@@ -453,7 +453,7 @@ The :mod:`!dbm.dumb` module defines the following:
453453

454454
.. exception:: error
455455

456-
Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:`KeyError` is
456+
Raised on :mod:`!dbm.dumb`-specific errors, such as I/O errors. :exc:`KeyError` is
457457
raised for general mapping errors like specifying an incorrect key.
458458

459459

@@ -484,7 +484,7 @@ The :mod:`!dbm.dumb` module defines the following:
484484
Python's AST compiler.
485485

486486
.. warning::
487-
:mod:`dbm.dumb` does not support concurrent read/write access. (Multiple
487+
:mod:`!dbm.dumb` does not support concurrent read/write access. (Multiple
488488
simultaneous read accesses are safe.) When a program has the database open
489489
for writing, no other program should have it open for reading or writing.
490490

Doc/library/dialog.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Tkinter Dialogs
22
===============
33

4-
:mod:`tkinter.simpledialog` --- Standard Tkinter input dialogs
5-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
:mod:`!tkinter.simpledialog` --- Standard Tkinter input dialogs
5+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
.. module:: tkinter.simpledialog
88
:platform: Tk
@@ -12,7 +12,7 @@ Tkinter Dialogs
1212

1313
--------------
1414

15-
The :mod:`tkinter.simpledialog` module contains convenience classes and
15+
The :mod:`!tkinter.simpledialog` module contains convenience classes and
1616
functions for creating simple modal dialogs to get a value from the user.
1717

1818

@@ -39,8 +39,8 @@ functions for creating simple modal dialogs to get a value from the user.
3939

4040

4141

42-
:mod:`tkinter.filedialog` --- File selection dialogs
43-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
:mod:`!tkinter.filedialog` --- File selection dialogs
43+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4444

4545
.. module:: tkinter.filedialog
4646
:platform: Tk
@@ -50,7 +50,7 @@ functions for creating simple modal dialogs to get a value from the user.
5050

5151
--------------
5252

53-
The :mod:`tkinter.filedialog` module provides classes and factory functions for
53+
The :mod:`!tkinter.filedialog` module provides classes and factory functions for
5454
creating file/directory selection windows.
5555

5656
Native Load/Save Dialogs
@@ -204,8 +204,8 @@ These do not emulate the native look-and-feel of the platform.
204204
directory. Confirmation is required if an already existing file is
205205
selected.
206206

207-
:mod:`tkinter.commondialog` --- Dialog window templates
208-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
207+
:mod:`!tkinter.commondialog` --- Dialog window templates
208+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209209

210210
.. module:: tkinter.commondialog
211211
:platform: Tk
@@ -215,7 +215,7 @@ These do not emulate the native look-and-feel of the platform.
215215

216216
--------------
217217

218-
The :mod:`tkinter.commondialog` module provides the :class:`Dialog` class that
218+
The :mod:`!tkinter.commondialog` module provides the :class:`Dialog` class that
219219
is the base class for dialogs defined in other supporting modules.
220220

221221
.. class:: Dialog(master=None, **options)

Doc/library/email.encoders.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ is especially true for :mimetype:`image/\*` and :mimetype:`text/\*` type message
2525
containing binary data.
2626

2727
The :mod:`email` package provides some convenient encoders in its
28-
:mod:`~email.encoders` module. These encoders are actually used by the
28+
:mod:`!encoders` module. These encoders are actually used by the
2929
:class:`~email.mime.audio.MIMEAudio` and :class:`~email.mime.image.MIMEImage`
3030
class constructors to provide default encodings. All encoder functions take
3131
exactly one argument, the message object to encode. They usually extract the

Doc/library/email.policy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ The header objects and their attributes are described in
602602

603603
This concrete :class:`Policy` is the backward compatibility policy. It
604604
replicates the behavior of the email package in Python 3.2. The
605-
:mod:`~email.policy` module also defines an instance of this class,
605+
:mod:`!policy` module also defines an instance of this class,
606606
:const:`compat32`, that is used as the default policy. Thus the default
607607
behavior of the email package is to maintain compatibility with Python 3.2.
608608

Doc/library/importlib.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ Functions
215215
in unexpected behavior. It's recommended to use the :class:`threading.Lock`
216216
or other synchronization primitives for thread-safe module reloading.
217217

218-
:mod:`importlib.abc` -- Abstract base classes related to import
219-
---------------------------------------------------------------
218+
:mod:`!importlib.abc` -- Abstract base classes related to import
219+
----------------------------------------------------------------
220220

221221
.. module:: importlib.abc
222222
:synopsis: Abstract base classes related to import
@@ -226,7 +226,7 @@ Functions
226226
--------------
227227

228228

229-
The :mod:`importlib.abc` module contains all of the core abstract base classes
229+
The :mod:`!importlib.abc` module contains all of the core abstract base classes
230230
used by :keyword:`import`. Some subclasses of the core abstract base classes
231231
are also provided to help in implementing the core ABCs.
232232

@@ -596,8 +596,8 @@ ABC hierarchy::
596596
itself does not end in ``__init__``.
597597

598598

599-
:mod:`importlib.machinery` -- Importers and path hooks
600-
------------------------------------------------------
599+
:mod:`!importlib.machinery` -- Importers and path hooks
600+
-------------------------------------------------------
601601

602602
.. module:: importlib.machinery
603603
:synopsis: Importers and path hooks
@@ -1112,8 +1112,8 @@ find and load modules.
11121112
Path to the ``.fwork`` file for the extension module.
11131113

11141114

1115-
:mod:`importlib.util` -- Utility code for importers
1116-
---------------------------------------------------
1115+
:mod:`!importlib.util` -- Utility code for importers
1116+
----------------------------------------------------
11171117

11181118
.. module:: importlib.util
11191119
:synopsis: Utility code for importers

0 commit comments

Comments
 (0)