Skip to content

Commit 02543a2

Browse files
Merge branch 'main' into import-zoneinfo-pydatetime
2 parents 312a09c + 539a4ca commit 02543a2

File tree

193 files changed

+6503
-2154
lines changed

Some content is hidden

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

193 files changed

+6503
-2154
lines changed

Doc/c-api/init_config.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,7 @@ If a ``._pth`` file is present:
22582258
* Set :c:member:`~PyConfig.isolated` to ``1``.
22592259
* Set :c:member:`~PyConfig.use_environment` to ``0``.
22602260
* Set :c:member:`~PyConfig.site_import` to ``0``.
2261+
* Set :c:member:`~PyConfig.user_site_directory` to ``0`` (since 3.15).
22612262
* Set :c:member:`~PyConfig.safe_path` to ``1``.
22622263
22632264
If :c:member:`~PyConfig.home` is not set and a ``pyvenv.cfg`` file is present in
@@ -2278,6 +2279,12 @@ The ``__PYVENV_LAUNCHER__`` environment variable is used to set
22782279
therefore affected by :option:`-S`.
22792280
22802281
2282+
.. versionchanged:: 3.15
2283+
2284+
:c:member:`~PyConfig.user_site_directory` is now set to ``0`` when a
2285+
``._pth`` file is present.
2286+
2287+
22812288
Py_GetArgcArgv()
22822289
================
22832290

Doc/howto/remote_debugging.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,13 @@ To locate a thread:
374374
reliable thread to target.
375375

376376
3. Optionally, use the offset ``interpreter_state.threads_head`` to iterate
377-
through the linked list of all thread states. Each ``PyThreadState`` structure
378-
contains a ``native_thread_id`` field, which may be compared to a target thread
379-
ID to find a specific thread.
377+
through the linked list of all thread states. Each ``PyThreadState``
378+
structure contains a ``native_thread_id`` field, which may be compared to
379+
a target thread ID to find a specific thread.
380380

381-
1. Once a valid ``PyThreadState`` has been found, its address can be used in
382-
later steps of the protocol, such as writing debugger control fields and
383-
scheduling execution.
381+
4. Once a valid ``PyThreadState`` has been found, its address can be used in
382+
later steps of the protocol, such as writing debugger control fields and
383+
scheduling execution.
384384

385385
The following is an example implementation that locates the main thread state::
386386

@@ -454,15 +454,15 @@ its fields are defined by the ``_Py_DebugOffsets`` structure and include the
454454
following:
455455

456456
- ``debugger_script_path``: A fixed-size buffer that holds the full path to a
457-
Python source file (``.py``). This file must be accessible and readable by
458-
the target process when execution is triggered.
457+
Python source file (``.py``). This file must be accessible and readable by
458+
the target process when execution is triggered.
459459

460460
- ``debugger_pending_call``: An integer flag. Setting this to ``1`` tells the
461-
interpreter that a script is ready to be executed.
461+
interpreter that a script is ready to be executed.
462462

463463
- ``eval_breaker``: A field checked by the interpreter during execution.
464-
Setting bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``, value ``1U << 5``) in this
465-
field causes the interpreter to pause and check for debugger activity.
464+
Setting bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``, value ``1U << 5``) in this
465+
field causes the interpreter to pause and check for debugger activity.
466466

467467
To complete the injection, the debugger must perform the following steps:
468468

Doc/library/_thread.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,16 @@ This module defines the following constants and functions:
120120
Its value may be used to uniquely identify this particular thread system-wide
121121
(until the thread terminates, after which the value may be recycled by the OS).
122122

123-
.. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD.
123+
.. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD, Solaris.
124124

125125
.. versionadded:: 3.8
126126

127127
.. versionchanged:: 3.13
128128
Added support for GNU/kFreeBSD.
129129

130+
.. versionchanged:: next
131+
Added support for Solaris.
132+
130133

131134
.. function:: stack_size([size])
132135

Doc/library/asyncio-eventloop.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,12 @@ clocks to track time.
304304
custom :class:`contextvars.Context` for the *callback* to run in.
305305
The current context is used when no *context* is provided.
306306

307+
.. note::
308+
309+
For performance, callbacks scheduled with :meth:`loop.call_later`
310+
may run up to one clock-resolution early (see
311+
``time.get_clock_info('monotonic').resolution``).
312+
307313
.. versionchanged:: 3.7
308314
The *context* keyword-only parameter was added. See :pep:`567`
309315
for more details.
@@ -324,6 +330,12 @@ clocks to track time.
324330
An instance of :class:`asyncio.TimerHandle` is returned which can
325331
be used to cancel the callback.
326332

333+
.. note::
334+
335+
For performance, callbacks scheduled with :meth:`loop.call_at`
336+
may run up to one clock-resolution early (see
337+
``time.get_clock_info('monotonic').resolution``).
338+
327339
.. versionchanged:: 3.7
328340
The *context* keyword-only parameter was added. See :pep:`567`
329341
for more details.

Doc/library/asyncio-protocol.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,11 @@ Subprocess Transports
390390
Return the transport for the communication pipe corresponding to the
391391
integer file descriptor *fd*:
392392

393-
* ``0``: readable streaming transport of the standard input (*stdin*),
393+
* ``0``: writable streaming transport of the standard input (*stdin*),
394394
or :const:`None` if the subprocess was not created with ``stdin=PIPE``
395-
* ``1``: writable streaming transport of the standard output (*stdout*),
395+
* ``1``: readable streaming transport of the standard output (*stdout*),
396396
or :const:`None` if the subprocess was not created with ``stdout=PIPE``
397-
* ``2``: writable streaming transport of the standard error (*stderr*),
397+
* ``2``: readable streaming transport of the standard error (*stderr*),
398398
or :const:`None` if the subprocess was not created with ``stderr=PIPE``
399399
* other *fd*: :const:`None`
400400

Doc/library/asyncio-stream.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ StreamWriter
321321
stream.write(data)
322322
await stream.drain()
323323

324+
.. note::
325+
The *data* buffer should be a C contiguous one-dimensional :term:`bytes-like object <bytes-like object>`.
326+
324327
.. method:: writelines(data)
325328

326329
The method writes a list (or any iterable) of bytes to the underlying socket

Doc/library/asyncio-sync.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Event
157157

158158
Clear (unset) the event.
159159

160-
Tasks awaiting on :meth:`~Event.wait` will now block until the
160+
Subsequent tasks awaiting on :meth:`~Event.wait` will now block until the
161161
:meth:`~Event.set` method is called again.
162162

163163
.. method:: is_set()

Doc/library/dataclasses.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ Module contents
161161
:class:`object`, this means it will fall back to id-based hashing).
162162

163163
- *frozen*: If true (the default is ``False``), assigning to fields will
164-
generate an exception. This emulates read-only frozen instances. If
165-
:meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in the class, then
166-
:exc:`TypeError` is raised. See the discussion below.
164+
generate an exception. This emulates read-only frozen instances.
165+
See the :ref:`discussion <dataclasses-frozen>` below.
166+
167+
If :meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in the class
168+
and *frozen* is true, then :exc:`TypeError` is raised.
167169

168170
- *match_args*: If true (the default is ``True``), the
169171
:attr:`~object.__match_args__` tuple will be created from the list of

Doc/library/dbm.rst

Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ the Oracle Berkeley DB.
9090
.. versionchanged:: 3.11
9191
*file* accepts a :term:`path-like object`.
9292

93-
The object returned by :func:`~dbm.open` supports the same basic functionality as a
94-
:class:`dict`; keys and their corresponding values can be stored, retrieved, and
95-
deleted, and the :keyword:`in` operator and the :meth:`!keys` method are
96-
available, as well as :meth:`!get` and :meth:`!setdefault` methods.
93+
The object returned by :func:`~dbm.open` supports the basic
94+
functionality of mutable :term:`mappings <mapping>`;
95+
keys and their corresponding values can be stored, retrieved, and
96+
deleted, and iteration, the :keyword:`in` operator and methods :meth:`!keys`,
97+
:meth:`!get`, :meth:`!setdefault` and :meth:`!clear` are available.
98+
The :meth:`!keys` method returns a list instead of a view object.
99+
The :meth:`!setdefault` method requires two arguments.
97100

98101
Key and values are always stored as :class:`bytes`. This means that when
99102
strings are used they are implicitly converted to the default encoding before
@@ -114,6 +117,10 @@ will automatically close them when done.
114117
Deleting a key from a read-only database raises a database module specific exception
115118
instead of :exc:`KeyError`.
116119

120+
.. versionchanged:: 3.13
121+
:meth:`!clear` methods are now available for all :mod:`dbm` backends.
122+
123+
117124
The following example records some hostnames and a corresponding title, and
118125
then prints out the contents of the database::
119126

@@ -173,9 +180,6 @@ or any other SQLite browser, including the SQLite CLI.
173180
.. function:: open(filename, /, flag="r", mode=0o666)
174181

175182
Open an SQLite database.
176-
The returned object behaves like a :term:`mapping`,
177-
implements a :meth:`!close` method,
178-
and supports a "closing" context manager via the :keyword:`with` keyword.
179183

180184
:param filename:
181185
The path to the database to be opened.
@@ -192,6 +196,17 @@ or any other SQLite browser, including the SQLite CLI.
192196
The Unix file access mode of the file (default: octal ``0o666``),
193197
used only when the database has to be created.
194198

199+
The returned database object behaves similar to a mutable :term:`mapping`,
200+
but the :meth:`!keys` method returns a list, and
201+
the :meth:`!setdefault` method requires two arguments.
202+
It also supports a "closing" context manager via the :keyword:`with` keyword.
203+
204+
The following methods are also provided:
205+
206+
.. method:: sqlite3.close()
207+
208+
Close the SQLite database.
209+
195210
.. method:: sqlite3.reorganize()
196211

197212
If you have carried out a lot of deletions and would like to shrink the space
@@ -204,6 +219,7 @@ or any other SQLite browser, including the SQLite CLI.
204219

205220
.. versionadded:: next
206221

222+
207223
:mod:`dbm.gnu` --- GNU database manager
208224
---------------------------------------
209225

@@ -232,6 +248,11 @@ functionality like crash tolerance.
232248
raised for general mapping errors like specifying an incorrect key.
233249

234250

251+
.. data:: open_flags
252+
253+
A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` supports.
254+
255+
235256
.. function:: open(filename, flag="r", mode=0o666, /)
236257

237258
Open a GDBM database and return a :class:`!gdbm` object.
@@ -270,14 +291,25 @@ functionality like crash tolerance.
270291
.. versionchanged:: 3.11
271292
*filename* accepts a :term:`path-like object`.
272293

273-
.. data:: open_flags
294+
:class:`!gdbm` objects behave similar to mutable :term:`mappings <mapping>`,
295+
but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`,
296+
and :meth:`!update` are not supported,
297+
the :meth:`!keys` method returns a list, and
298+
the :meth:`!setdefault` method requires two arguments.
299+
It also supports a "closing" context manager via the :keyword:`with` keyword.
300+
301+
.. versionchanged:: 3.2
302+
Added the :meth:`!get` and :meth:`!setdefault` methods.
274303

275-
A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` supports.
304+
.. versionchanged:: 3.13
305+
Added the :meth:`!clear` method.
276306

277-
:class:`!gdbm` objects behave similar to :term:`mappings <mapping>`,
278-
but :meth:`!items` and :meth:`!values` methods are not supported.
279307
The following methods are also provided:
280308

309+
.. method:: gdbm.close()
310+
311+
Close the GDBM database.
312+
281313
.. method:: gdbm.firstkey()
282314

283315
It's possible to loop over every key in the database using this method and the
@@ -313,16 +345,6 @@ functionality like crash tolerance.
313345
When the database has been opened in fast mode, this method forces any
314346
unwritten data to be written to the disk.
315347

316-
.. method:: gdbm.close()
317-
318-
Close the GDBM database.
319-
320-
.. method:: gdbm.clear()
321-
322-
Remove all items from the GDBM database.
323-
324-
.. versionadded:: 3.13
325-
326348

327349
:mod:`dbm.ndbm` --- New Database Manager
328350
----------------------------------------
@@ -383,22 +405,27 @@ This module can be used with the "classic" NDBM interface or the
383405
:param int mode:
384406
|mode_param_doc|
385407

386-
:class:`!ndbm` objects behave similar to :term:`mappings <mapping>`,
387-
but :meth:`!items` and :meth:`!values` methods are not supported.
388-
The following methods are also provided:
389-
390408
.. versionchanged:: 3.11
391409
Accepts :term:`path-like object` for filename.
392410

393-
.. method:: ndbm.close()
411+
:class:`!ndbm` objects behave similar to mutable :term:`mappings <mapping>`,
412+
but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`,
413+
and :meth:`!update` are not supported,
414+
the :meth:`!keys` method returns a list, and
415+
the :meth:`!setdefault` method requires two arguments.
416+
It also supports a "closing" context manager via the :keyword:`with` keyword.
394417

395-
Close the NDBM database.
418+
.. versionchanged:: 3.2
419+
Added the :meth:`!get` and :meth:`!setdefault` methods.
396420

397-
.. method:: ndbm.clear()
421+
.. versionchanged:: 3.13
422+
Added the :meth:`!clear` method.
398423

399-
Remove all items from the NDBM database.
424+
The following method is also provided:
400425

401-
.. versionadded:: 3.13
426+
.. method:: ndbm.close()
427+
428+
Close the NDBM database.
402429

403430

404431
:mod:`dbm.dumb` --- Portable DBM implementation
@@ -436,9 +463,6 @@ The :mod:`!dbm.dumb` module defines the following:
436463
.. function:: open(filename, flag="c", mode=0o666)
437464

438465
Open a :mod:`!dbm.dumb` database.
439-
The returned database object behaves similar to a :term:`mapping`,
440-
in addition to providing :meth:`~dumbdbm.sync` and :meth:`~dumbdbm.close`
441-
methods.
442466

443467
:param filename:
444468
The basename of the database file (without extensions).
@@ -477,14 +501,12 @@ The :mod:`!dbm.dumb` module defines the following:
477501
.. versionchanged:: 3.11
478502
*filename* accepts a :term:`path-like object`.
479503

480-
In addition to the methods provided by the
481-
:class:`collections.abc.MutableMapping` class,
482-
the following methods are provided:
504+
The returned database object behaves similar to a mutable :term:`mapping`,
505+
but the :meth:`!keys` and :meth:`!items` methods return lists, and
506+
the :meth:`!setdefault` method requires two arguments.
507+
It also supports a "closing" context manager via the :keyword:`with` keyword.
483508

484-
.. method:: dumbdbm.sync()
485-
486-
Synchronize the on-disk directory and data files. This method is called
487-
by the :meth:`shelve.Shelf.sync` method.
509+
The following methods are also provided:
488510

489511
.. method:: dumbdbm.close()
490512

@@ -501,3 +523,8 @@ The :mod:`!dbm.dumb` module defines the following:
501523
that this factor changes for each :mod:`dbm` submodule.
502524

503525
.. versionadded:: next
526+
527+
.. method:: dumbdbm.sync()
528+
529+
Synchronize the on-disk directory and data files. This method is called
530+
by the :meth:`shelve.Shelf.sync` method.

0 commit comments

Comments
 (0)