aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Doc/library
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/argparse.rst2
-rw-r--r--Doc/library/concurrent.futures.rst19
-rw-r--r--Doc/library/dialog.rst2
-rw-r--r--Doc/library/functions.rst10
-rw-r--r--Doc/library/netrc.rst4
-rw-r--r--Doc/library/pkgutil.rst4
-rw-r--r--Doc/library/shutil.rst11
-rw-r--r--Doc/library/sys.rst25
-rw-r--r--Doc/library/uuid.rst29
-rw-r--r--Doc/library/zoneinfo.rst4
10 files changed, 69 insertions, 41 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 17f126cc065..a03d88092db 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -955,7 +955,7 @@ See also :ref:`specifying-ambiguous-arguments`. The supported values are:
.. index:: single: + (plus); in argparse module
-* ``'+'``. Just like ``'*'``, all command-line args present are gathered into a
+* ``'+'``. Just like ``'*'``, all command-line arguments present are gathered into a
list. Additionally, an error message will be generated if there wasn't at
least one command-line argument present. For example::
diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst
index 3c8d9ab111e..dd92765038c 100644
--- a/Doc/library/concurrent.futures.rst
+++ b/Doc/library/concurrent.futures.rst
@@ -265,7 +265,7 @@ Each worker's interpreter is isolated from all the other interpreters.
"Isolated" means each interpreter has its own runtime state and
operates completely independently. For example, if you redirect
:data:`sys.stdout` in one interpreter, it will not be automatically
-redirected any other interpreter. If you import a module in one
+redirected to any other interpreter. If you import a module in one
interpreter, it is not automatically imported in any other. You
would need to import the module separately in interpreter where
you need it. In fact, each module imported in an interpreter is
@@ -287,7 +287,7 @@ efficient alternative is to serialize with :mod:`pickle` and then send
the bytes over a shared :mod:`socket <socket>` or
:func:`pipe <os.pipe>`.
-.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), shared=None)
+.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously
using a pool of at most *max_workers* threads. Each thread runs
@@ -305,20 +305,9 @@ the bytes over a shared :mod:`socket <socket>` or
interpreter.
.. note::
- Functions defined in the ``__main__`` module cannot be pickled
- and thus cannot be used.
-
- .. note::
The executor may replace uncaught exceptions from *initializer*
with :class:`~concurrent.futures.interpreter.ExecutionFailed`.
- The optional *shared* argument is a :class:`dict` of objects that all
- interpreters in the pool share. The *shared* items are added to each
- interpreter's ``__main__`` module. Not all objects are shareable.
- Shareable objects include the builtin singletons, :class:`str`
- and :class:`bytes`, and :class:`memoryview`. See :pep:`734`
- for more info.
-
Other caveats from parent :class:`ThreadPoolExecutor` apply here.
:meth:`~Executor.submit` and :meth:`~Executor.map` work like normal,
@@ -326,10 +315,6 @@ except the worker serializes the callable and arguments using
:mod:`pickle` when sending them to its interpreter. The worker
likewise serializes the return value when sending it back.
-.. note::
- Functions defined in the ``__main__`` module cannot be pickled
- and thus cannot be used.
-
When a worker's current task raises an uncaught exception, the worker
always tries to preserve the exception as-is. If that is successful
then it also sets the ``__cause__`` to a corresponding
diff --git a/Doc/library/dialog.rst b/Doc/library/dialog.rst
index 191e0da1210..e0693e8eb6e 100644
--- a/Doc/library/dialog.rst
+++ b/Doc/library/dialog.rst
@@ -220,7 +220,7 @@ is the base class for dialogs defined in other supporting modules.
.. class:: Dialog(master=None, **options)
- .. method:: show(color=None, **options)
+ .. method:: show(**options)
Render the Dialog window.
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 2ecce3dba5a..80bd1275973 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1839,15 +1839,15 @@ are always available. They are listed here in alphabetical order.
``range(start, stop, step)``. The *start* and *step* arguments default to
``None``.
+ Slice objects have read-only data attributes :attr:`!start`,
+ :attr:`!stop`, and :attr:`!step` which merely return the argument
+ values (or their default). They have no other explicit functionality;
+ however, they are used by NumPy and other third-party packages.
+
.. attribute:: slice.start
.. attribute:: slice.stop
.. attribute:: slice.step
- Slice objects have read-only data attributes :attr:`!start`,
- :attr:`!stop`, and :attr:`!step` which merely return the argument
- values (or their default). They have no other explicit functionality;
- however, they are used by NumPy and other third-party packages.
-
Slice objects are also generated when extended indexing syntax is used. For
example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See
:func:`itertools.islice` for an alternate version that returns an
diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst
index f6260383b2b..74c97e8c9a9 100644
--- a/Doc/library/netrc.rst
+++ b/Doc/library/netrc.rst
@@ -24,12 +24,14 @@ the Unix :program:`ftp` program and other FTP clients.
a :exc:`FileNotFoundError` exception will be raised.
Parse errors will raise :exc:`NetrcParseError` with diagnostic
information including the file name, line number, and terminating token.
+
If no argument is specified on a POSIX system, the presence of passwords in
the :file:`.netrc` file will raise a :exc:`NetrcParseError` if the file
ownership or permissions are insecure (owned by a user other than the user
running the process, or accessible for read or write by any other user).
This implements security behavior equivalent to that of ftp and other
- programs that use :file:`.netrc`.
+ programs that use :file:`.netrc`. Such security checks are not available
+ on platforms that do not support :func:`os.getuid`.
.. versionchanged:: 3.4 Added the POSIX permission check.
diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst
index 20b8f6bcf19..47d24b6f7d0 100644
--- a/Doc/library/pkgutil.rst
+++ b/Doc/library/pkgutil.rst
@@ -69,8 +69,8 @@ support.
Yield :term:`finder` objects for the given module name.
- If fullname contains a ``'.'``, the finders will be for the package
- containing fullname, otherwise they will be all registered top level
+ If *fullname* contains a ``'.'``, the finders will be for the package
+ containing *fullname*, otherwise they will be all registered top level
finders (i.e. those on both :data:`sys.meta_path` and :data:`sys.path_hooks`).
If the named module is in a package, that package is imported as a side
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index c78dfe1aafa..2dde40c9d92 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -47,6 +47,13 @@ Directory and files operations
0, only the contents from the current file position to the end of the file will
be copied.
+ :func:`copyfileobj` will *not* guarantee that the destination stream has
+ been flushed on completion of the copy. If you want to read from the
+ destination at the completion of the copy operation (for example, reading
+ the contents of a temporary file that has been copied from a HTTP stream),
+ you must ensure that you have called :func:`~io.IOBase.flush` or
+ :func:`~io.IOBase.close` on the file-like object before attempting to read
+ the destination file.
.. function:: copyfile(src, dst, *, follow_symlinks=True)
@@ -327,6 +334,10 @@ Directory and files operations
The deprecated *onerror* is similar to *onexc*, except that the third
parameter it receives is the tuple returned from :func:`sys.exc_info`.
+ .. seealso::
+ :ref:`shutil-rmtree-example` for an example of handling the removal
+ of a directory tree that contains read-only files.
+
.. audit-event:: shutil.rmtree path,dir_fd shutil.rmtree
.. versionchanged:: 3.3
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 71f9999464a..1626a89a073 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -1185,6 +1185,15 @@ always available. Unless explicitly noted otherwise, all variables are read-only
``cache_tag`` is set to ``None``, it indicates that module caching should
be disabled.
+ *supports_isolated_interpreters* is a boolean value, whether
+ this implementation supports multiple isolated interpreters.
+ It is ``True`` for CPython on most platforms. Platforms with
+ this support implement the low-level :mod:`!_interpreters` module.
+
+ .. seealso::
+
+ :pep:`684`, :pep:`734`, and :mod:`concurrent.interpreters`.
+
:data:`sys.implementation` may contain additional attributes specific to
the Python implementation. These non-standard attributes must start with
an underscore, and are not described here. Regardless of its contents,
@@ -1194,6 +1203,9 @@ always available. Unless explicitly noted otherwise, all variables are read-only
.. versionadded:: 3.3
+ .. versionchanged:: 3.14
+ Added ``supports_isolated_interpreters`` field.
+
.. note::
The addition of new required attributes must go through the normal PEP
@@ -1933,12 +1945,21 @@ always available. Unless explicitly noted otherwise, all variables are read-only
interpreter is pre-release (alpha, beta, or release candidate) then the
local and remote interpreters must be the same exact version.
- .. audit-event:: remote_debugger_script script_path
+ .. audit-event:: sys.remote_exec pid script_path
+
+ When the code is executed in the remote process, an
+ :ref:`auditing event <auditing>` ``sys.remote_exec`` is raised with
+ the *pid* and the path to the script file.
+ This event is raised in the process that called :func:`sys.remote_exec`.
+
+ .. audit-event:: cpython.remote_debugger_script script_path
When the script is executed in the remote process, an
:ref:`auditing event <auditing>`
- ``sys.remote_debugger_script`` is raised
+ ``cpython.remote_debugger_script`` is raised
with the path in the remote process.
+ This event is raised in the remote process, not the one
+ that called :func:`sys.remote_exec`.
.. availability:: Unix, Windows.
.. versionadded:: 3.14
diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst
index 92d58024e84..6698e6d3f43 100644
--- a/Doc/library/uuid.rst
+++ b/Doc/library/uuid.rst
@@ -193,43 +193,52 @@ The :mod:`uuid` module defines the following functions:
.. function:: uuid1(node=None, clock_seq=None)
- Generate a UUID from a host ID, sequence number, and the current time. If *node*
- is not given, :func:`getnode` is used to obtain the hardware address. If
- *clock_seq* is given, it is used as the sequence number; otherwise a random
- 14-bit sequence number is chosen.
+ Generate a UUID from a host ID, sequence number, and the current time
+ according to :rfc:`RFC 9562, §5.1 <9562#section-5.1>`.
+
+ When *node* is not specified, :func:`getnode` is used to obtain the hardware
+ address as a 48-bit positive integer. When a sequence number *clock_seq* is
+ not specified, a pseudo-random 14-bit positive integer is generated.
+
+ If *node* or *clock_seq* exceed their expected bit count,
+ only their least significant bits are kept.
.. function:: uuid3(namespace, name)
Generate a UUID based on the MD5 hash of a namespace identifier (which is a
UUID) and a name (which is a :class:`bytes` object or a string
- that will be encoded using UTF-8).
+ that will be encoded using UTF-8)
+ according to :rfc:`RFC 9562, §5.3 <9562#section-5.3>`.
.. function:: uuid4()
- Generate a random UUID.
+ Generate a random UUID in a cryptographically-secure method
+ according to :rfc:`RFC 9562, §5.4 <9562#section-5.4>`.
.. function:: uuid5(namespace, name)
Generate a UUID based on the SHA-1 hash of a namespace identifier (which is a
UUID) and a name (which is a :class:`bytes` object or a string
- that will be encoded using UTF-8).
+ that will be encoded using UTF-8)
+ according to :rfc:`RFC 9562, §5.5 <9562#section-5.5>`.
.. function:: uuid6(node=None, clock_seq=None)
Generate a UUID from a sequence number and the current time according to
- :rfc:`9562`.
+ :rfc:`RFC 9562, §5.6 <9562#section-5.6>`.
+
This is an alternative to :func:`uuid1` to improve database locality.
When *node* is not specified, :func:`getnode` is used to obtain the hardware
address as a 48-bit positive integer. When a sequence number *clock_seq* is
not specified, a pseudo-random 14-bit positive integer is generated.
- If *node* or *clock_seq* exceed their expected bit count, only their least
- significant bits are kept.
+ If *node* or *clock_seq* exceed their expected bit count,
+ only their least significant bits are kept.
.. versionadded:: 3.14
diff --git a/Doc/library/zoneinfo.rst b/Doc/library/zoneinfo.rst
index a57f3b8b3e8..53d8e2598ec 100644
--- a/Doc/library/zoneinfo.rst
+++ b/Doc/library/zoneinfo.rst
@@ -195,7 +195,7 @@ The ``ZoneInfo`` class
The ``ZoneInfo`` class has two alternate constructors:
-.. classmethod:: ZoneInfo.from_file(fobj, /, key=None)
+.. classmethod:: ZoneInfo.from_file(file_obj, /, key=None)
Constructs a ``ZoneInfo`` object from a file-like object returning bytes
(e.g. a file opened in binary mode or an :class:`io.BytesIO` object).
@@ -325,7 +325,7 @@ The behavior of a ``ZoneInfo`` file depends on how it was constructed:
>>> a is b
False
-3. ``ZoneInfo.from_file(fobj, /, key=None)``: When constructed from a file, the
+3. ``ZoneInfo.from_file(file_obj, /, key=None)``: When constructed from a file, the
``ZoneInfo`` object raises an exception on pickling. If an end user wants to
pickle a ``ZoneInfo`` constructed from a file, it is recommended that they
use a wrapper type or a custom serialization function: either serializing by