From fca06dc733350860ec468310748398e06c0854fa Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Thu, 29 Oct 2026 08:49:26 +0000 Subject: [PATCH 1/2] Doc: fix broken links --- Doc/library/calendar.rst | 3 ++- Doc/library/ctypes.rst | 3 ++- Doc/library/datetime.rst | 3 ++- Doc/library/dis.rst | 4 ++-- Doc/library/fnmatch.rst | 3 ++- Doc/library/getopt.rst | 6 ++++-- Doc/library/getpass.rst | 6 ++++-- Doc/library/gettext.rst | 6 ++++-- Doc/library/glob.rst | 4 ++-- Doc/library/locale.rst | 2 +- Doc/library/marshal.rst | 3 ++- Doc/library/mmap.rst | 7 ++++--- Doc/library/msvcrt.rst | 2 +- Doc/library/multiprocessing.rst | 3 ++- Doc/library/multiprocessing.shared_memory.rst | 21 ++++++++++++------- Doc/library/netrc.rst | 2 +- Doc/library/optparse.rst | 3 ++- Doc/library/random.rst | 3 ++- Doc/library/shlex.rst | 3 ++- Doc/library/signal.rst | 5 +++-- Doc/library/sys.rst | 3 ++- Doc/library/syslog.rst | 21 ++++++++++++------- Doc/library/unicodedata.rst | 3 ++- Doc/whatsnew/2.3.rst | 3 ++- Doc/whatsnew/2.6.rst | 3 ++- Doc/whatsnew/3.2.rst | 3 ++- Doc/whatsnew/3.4.rst | 2 +- 27 files changed, 82 insertions(+), 48 deletions(-) diff --git a/Doc/library/calendar.rst b/Doc/library/calendar.rst index 0dc1481aeff01dd..18e0319d91fad95 100644 --- a/Doc/library/calendar.rst +++ b/Doc/library/calendar.rst @@ -432,7 +432,8 @@ For simple text calendars this module provides the following functions. .. function:: prcal(theyear, w=0, l=0, c=6, m=3) - Prints the calendar for an entire year as returned by :func:`calendar`. + Prints the calendar for an entire year as returned by + :func:`~calendar.calendar`. .. function:: calendar(theyear, w=2, l=1, c=6, m=3) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 1acf5e85af48d7b..f081962c911fc22 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -3758,7 +3758,8 @@ fields, or any other data types containing pointer type fields. .. class:: CFieldInfo(anonymous=False, bit_width=None) :module: ctypes.util - Information regarding a structure field defined by the :func:`struct` + Information regarding a structure field defined by the + :func:`~ctypes.util.struct` decorator. This should be used in the second argument of a :class:`typing.Annotated` wrapping a ctypes type. diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 691a1e127ad2b39..fe3309881cb6a2e 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1386,7 +1386,8 @@ Instance methods: hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond, \ tzinfo=self.tzinfo, *, fold=0) - Return a new :class:`datetime` object with the same attributes, but with + Return a new :class:`~datetime.datetime` object with the same attributes, but + with specified parameters updated. Note that ``tzinfo=None`` can be specified to create a naive datetime from an aware datetime with no conversion of date and time data. diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 15c138ee938bf66..7cfa713f9d0d403 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -395,9 +395,9 @@ operation is being performed, so the intermediate analysis object isn't useful: source line information (if any) is taken directly from the disassembled code object. - The *adaptive* parameter works as it does in :func:`dis`. + The *adaptive* parameter works as it does in :func:`~dis.dis`. - The *show_jit* parameter works as it does in :func:`dis`. + The *show_jit* parameter works as it does in :func:`~dis.dis`. .. versionadded:: 3.4 diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst index fc99b7fd1e7523a..2b0163bd4ce3535 100644 --- a/Doc/library/fnmatch.rst +++ b/Doc/library/fnmatch.rst @@ -53,7 +53,8 @@ a :class:`!str` filename, and vice-versa. Finally, note that :deco:`functools.lru_cache` with a *maxsize* of 32768 is used to cache the (typed) compiled regex patterns in the following -functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`, :func:`.filterfalse`. +functions: :func:`~fnmatch.fnmatch`, :func:`fnmatchcase`, :func:`.filter`, +:func:`.filterfalse`. .. function:: fnmatch(name, pat) diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst index 9995f114d063e82..f732e7918723552 100644 --- a/Doc/library/getopt.rst +++ b/Doc/library/getopt.rst @@ -80,9 +80,11 @@ exception: .. function:: gnu_getopt(args, shortopts, longopts=[]) - This function works like :func:`getopt`, except that GNU style scanning mode is + This function works like :func:`~getopt.getopt`, except that GNU style + scanning mode is used by default. This means that option and non-option arguments may be - intermixed. The :func:`getopt` function stops processing options as soon as a + intermixed. The :func:`~getopt.getopt` function stops processing options as + soon as a non-option argument is encountered. If the first character of the option string is ``'+'``, or if the environment diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst index f60cc63414f764d..73270e418d9d4d1 100644 --- a/Doc/library/getpass.rst +++ b/Doc/library/getpass.rst @@ -27,12 +27,14 @@ The :mod:`!getpass` module provides two functions: typed character is replaced by it. For example, ``echo_char='*'`` will display asterisks instead of the actual input. - If echo-free input is unavailable, :func:`getpass` falls back to printing + If echo-free input is unavailable, :func:`~getpass.getpass` falls back to + printing a warning message to *stream* and reading from :data:`sys.stdin` and issuing a :exc:`GetPassWarning`. .. note:: - If you call :func:`getpass` from within IDLE, the input may be done in the + If you call :func:`~getpass.getpass` from within IDLE, the input may be + done in the terminal you launched IDLE from rather than the idle window itself. .. note:: diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst index 2ab7ba7df19cf14..9d0e9b01b6a327b 100644 --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -89,7 +89,8 @@ class-based API instead. .. function:: dnpgettext(domain, context, singular, plural, n, /) Similar to the corresponding functions without the ``p`` in the prefix (that - is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`), + is, :func:`~gettext.gettext`, :func:`dgettext`, :func:`ngettext`, + :func:`dngettext`), but the translation is restricted to the given message *context*. .. versionadded:: 3.8 @@ -426,7 +427,8 @@ take the following steps: In order to prepare your code for I18N, you need to look at all the strings in your files. Any string that needs to be translated should be marked by wrapping -it in ``_('...')`` --- that is, a call to the function :func:`_ `. For example:: +it in ``_('...')`` --- that is, a call to the function +:func:`_ `. For example:: filename = 'mylog.txt' message = _('writing a log message') diff --git a/Doc/library/glob.rst b/Doc/library/glob.rst index bbeb808159d446b..98ef3d196828154 100644 --- a/Doc/library/glob.rst +++ b/Doc/library/glob.rst @@ -102,7 +102,7 @@ The :mod:`!glob` module defines the following functions: .. function:: iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, \ include_hidden=False) - Return an :term:`iterator` which yields the same values as :func:`glob` + Return an :term:`iterator` which yields the same values as :func:`~glob.glob` without actually storing them all simultaneously. .. audit-event:: glob.glob pathname,recursive glob.iglob @@ -182,7 +182,7 @@ Examples Consider a directory containing the following files: :file:`1.gif`, :file:`2.txt`, :file:`card.gif` and a subdirectory :file:`sub` -which contains only the file :file:`3.txt`. :func:`glob` will produce +which contains only the file :file:`3.txt`. :func:`~glob.glob` will produce the following results. Notice how any leading components of the path are preserved. :: diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index 59ca7a209adf5af..8659957be77fb62 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -715,7 +715,7 @@ Access to message catalogs .. function:: bind_textdomain_codeset(domain, codeset) The locale module exposes the C library's gettext interface on systems that -provide this interface. It consists of the functions :func:`gettext`, +provide this interface. It consists of the functions :func:`~locale.gettext`, :func:`dgettext`, :func:`dcgettext`, :func:`textdomain`, :func:`bindtextdomain`, and :func:`bind_textdomain_codeset`. These are similar to the same functions in the :mod:`gettext` module, but use the C library's binary format for message diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst index 4fe34f0a3a3f911..07ad895230342f6 100644 --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -58,7 +58,8 @@ this module. The following types are supported: therein are themselves supported. Recursive containers are supported since :data:`version` 3. * The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration`. -* :class:`code` objects, if *allow_code* is true. See note above about +* :class:`code ` objects, if *allow_code* is true. See note + above about version dependence. .. versionchanged:: 3.4 diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index e06a702d0b59f68..ef4efd7d9fb7d69 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -401,7 +401,7 @@ ACCESS_* constants :const:`ACCESS_READ` provides read-only access, :const:`ACCESS_WRITE` provides write-through access, and :const:`ACCESS_COPY` provides copy-on-write access. :const:`ACCESS_DEFAULT` defers to the *prot* - argument of :class:`mmap`. + argument of :class:`~mmap.mmap`. .. _page-size-constants: @@ -413,7 +413,7 @@ Page size constants :const:`PAGESIZE` is the system memory page size in bytes. :const:`ALLOCATIONGRANULARITY` is the minimum alignment in bytes required - for the *offset* argument of :class:`mmap`. On Unix, + for the *offset* argument of :class:`~mmap.mmap`. On Unix, :const:`ALLOCATIONGRANULARITY` is equal to :const:`PAGESIZE`. .. _prot-constants: @@ -425,7 +425,8 @@ PROT_* constants PROT_WRITE PROT_EXEC - Memory protection flags accepted by the *prot* argument of :class:`mmap`. + Memory protection flags accepted by the *prot* argument of + :class:`~mmap.mmap`. :const:`PROT_READ` allows pages to be read, :const:`PROT_WRITE` allows pages to be written, and :const:`PROT_EXEC` allows pages to be executed. Values can be combined using the bitwise OR operator. Not every option is present diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst index fc8d9cc87c755d8..27c73f81096ecef 100644 --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -11,7 +11,7 @@ These functions provide access to some useful capabilities on Windows platforms. Some higher-level modules use these functions to build the Windows implementations of their services. For example, the :mod:`getpass` module uses -this in the implementation of the :func:`getpass` function. +this in the implementation of the :func:`~getpass.getpass` function. Further documentation on these functions can be found in the Platform API documentation. diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index e80fdfda5bea36d..f96c90e331c0f3e 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2462,7 +2462,8 @@ with the :class:`Pool` class. the process which created the pool. .. warning:: - :class:`multiprocessing.pool` objects have internal resources that need to be + :class:`~multiprocessing.pool.Pool` objects have internal resources that + need to be properly managed (like any other resource) by using the pool as a context manager or by calling :meth:`close` and :meth:`terminate` manually. Failure to do this can lead to the process hanging on finalization. diff --git a/Doc/library/multiprocessing.shared_memory.rst b/Doc/library/multiprocessing.shared_memory.rst index e8f04a6ac7b95db..27689a172468028 100644 --- a/Doc/library/multiprocessing.shared_memory.rst +++ b/Doc/library/multiprocessing.shared_memory.rst @@ -215,13 +215,16 @@ same :class:`!numpy.ndarray` from two distinct Python shells: of all shared memory blocks managed by that process, call :meth:`~multiprocessing.managers.BaseManager.shutdown` on the instance. This triggers a :meth:`~multiprocessing.shared_memory.SharedMemory.unlink` call - on all of the :class:`SharedMemory` objects managed by that process and then - stops the process itself. By creating :class:`!SharedMemory` instances + on all of the :class:`~multiprocessing.shared_memory.SharedMemory` objects + managed by that process and then stops the process itself. + By creating :class:`!SharedMemory` instances through a :class:`!SharedMemoryManager`, we avoid the need to manually track and trigger the freeing of shared memory resources. - This class provides methods for creating and returning :class:`SharedMemory` - instances and for creating a list-like object (:class:`ShareableList`) + This class provides methods for creating and returning + :class:`~multiprocessing.shared_memory.SharedMemory` instances and for + creating + a list-like object (:class:`~multiprocessing.shared_memory.ShareableList`) backed by shared memory. Refer to :class:`~multiprocessing.managers.BaseManager` for a description @@ -231,13 +234,15 @@ same :class:`!numpy.ndarray` from two distinct Python shells: .. method:: SharedMemory(size) - Create and return a new :class:`SharedMemory` object with the - specified *size* in bytes. + Create and return a new + :class:`~multiprocessing.shared_memory.SharedMemory` + object with the specified *size* in bytes. .. method:: ShareableList(sequence) - Create and return a new :class:`ShareableList` object, initialized - by the values from the input *sequence*. + Create and return a new + :class:`~multiprocessing.shared_memory.ShareableList` + object, initialized by the values from the input *sequence*. The following example demonstrates the basic mechanisms of a diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst index 3fbd2b57426ebe7..14d47514738dbdc 100644 --- a/Doc/library/netrc.rst +++ b/Doc/library/netrc.rst @@ -37,7 +37,7 @@ the Unix :program:`ftp` program and other FTP clients. :file:`.netrc` file when *file* is not passed as argument. .. versionchanged:: 3.10 - :class:`netrc` try UTF-8 encoding before using locale specific + :class:`~netrc.netrc` try UTF-8 encoding before using locale specific encoding. The entry in the netrc file no longer needs to contain all tokens. The missing tokens' value default to an empty string. All the tokens and their values now diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst index 741da8424fce4a8..c36503ac47b445d 100644 --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -2040,7 +2040,8 @@ Finally, the Option subclass:: TYPE_CHECKER = copy(Option.TYPE_CHECKER) TYPE_CHECKER["complex"] = check_complex -(If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would end +(If we didn't make a :func:`~copy.copy` of :attr:`Option.TYPE_CHECKER`, we would +end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:`!optparse`'s Option class. This being Python, nothing stops you from doing that except good manners and common sense.) diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 73a37e189ddf2a8..8ef5ba4de2809b6 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -193,7 +193,8 @@ Functions for sequences to specify both *weights* and *cum_weights*. The *weights* or *cum_weights* can use any numeric type that interoperates - with the :class:`float` values returned by :func:`random` (that includes + with the :class:`float` values returned by :func:`~random.random` (that + includes integers, floats, and fractions but excludes decimals). Weights are assumed to be non-negative and finite. A :exc:`ValueError` is raised if all weights are zero. diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst index 63deb4c7f7645ca..e2ce18542e7a360 100644 --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -411,7 +411,8 @@ Improved Compatibility with Shells .. versionadded:: 3.6 -The :class:`shlex` class provides compatibility with the parsing performed by +The :class:`~shlex.shlex` class provides compatibility with the parsing +performed by common Unix shells like ``bash``, ``dash``, and ``sh``. To take advantage of this compatibility, specify the ``punctuation_chars`` argument in the constructor. This defaults to ``False``, which preserves pre-3.6 behaviour. diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst index 12ad45f557e6db5..e6cf11dcf7cb57f 100644 --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -604,7 +604,8 @@ The :mod:`!signal` module defines the following functions: See the man page :manpage:`siginterrupt(3)` for further information. - Note that installing a signal handler with :func:`signal` will reset the + Note that installing a signal handler with :func:`~signal.signal` will reset + the restart behaviour to interruptible by implicitly calling :c:func:`!siginterrupt` with a true *flag* value for the given signal. @@ -627,7 +628,7 @@ The :mod:`!signal` module defines the following functions: see the :ref:`description in the type hierarchy ` or see the attribute descriptions in the :mod:`inspect` module). - On Windows, :func:`signal` can only be called with :const:`SIGABRT`, + On Windows, :func:`~signal.signal` can only be called with :const:`SIGABRT`, :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:`SIGTERM`, or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any other case. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 305881a2e591d34..5ed0048d4369ace 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -592,7 +592,8 @@ always available. Unless explicitly noted otherwise, all variables are read-only particular, ``sys.exit("some error message")`` is a quick way to exit a program when an error occurs. - Since :func:`exit` ultimately "only" raises an exception, it will only exit + Since :func:`~sys.exit` ultimately "only" raises an exception, it will only + exit the process when called from the main thread, and the exception is not intercepted. Cleanup actions specified by :keyword:`finally` clauses of :keyword:`try` statements are honored, and it is possible to intercept the diff --git a/Doc/library/syslog.rst b/Doc/library/syslog.rst index b6bf01240951ebd..8b4e5a657085ea0 100644 --- a/Doc/library/syslog.rst +++ b/Doc/library/syslog.rst @@ -29,28 +29,33 @@ The module defines the following functions: not encoded in *priority* using logical-or (``LOG_INFO | LOG_USER``), the value given in the :func:`openlog` call is used. - If :func:`openlog` has not been called prior to the call to :func:`syslog`, + If :func:`openlog` has not been called prior to the call to + :func:`~syslog.syslog`, :func:`openlog` will be called with no arguments. .. audit-event:: syslog.syslog priority,message syslog.syslog .. versionchanged:: 3.2 In previous versions, :func:`openlog` would not be called automatically if - it wasn't called prior to the call to :func:`syslog`, deferring to the syslog + it wasn't called prior to the call to :func:`~syslog.syslog`, deferring to + the syslog implementation to call ``openlog()``. .. versionchanged:: 3.12 This function is restricted in subinterpreters. (Only code that runs in multiple interpreters is affected and the restriction is not relevant for most users.) - :func:`openlog` must be called in the main interpreter before :func:`syslog` may be used + :func:`openlog` must be called in the main interpreter before + :func:`~syslog.syslog` may be used in a subinterpreter. Otherwise it will raise :exc:`RuntimeError`. .. function:: openlog([ident[, logoption[, facility]]]) - Logging options of subsequent :func:`syslog` calls can be set by calling - :func:`openlog`. :func:`syslog` will call :func:`openlog` with no arguments + Logging options of subsequent :func:`~syslog.syslog` calls can be set by + calling + :func:`openlog`. :func:`~syslog.syslog` will call :func:`openlog` with no + arguments if the log is not currently open. The optional *ident* keyword argument is a string which is prepended to every @@ -79,7 +84,8 @@ The module defines the following functions: Reset the syslog module values and call the system library ``closelog()``. This causes the module to behave as it does when initially imported. For - example, :func:`openlog` will be called on the first :func:`syslog` call (if + example, :func:`openlog` will be called on the first :func:`~syslog.syslog` + call (if :func:`openlog` hasn't already been called), and *ident* and other :func:`openlog` parameters are reset to defaults. @@ -96,7 +102,8 @@ The module defines the following functions: .. function:: setlogmask(maskpri) Set the priority mask to *maskpri* and return the previous mask value. Calls - to :func:`syslog` with a priority level not set in *maskpri* are ignored. + to :func:`~syslog.syslog` with a priority level not set in *maskpri* are + ignored. The default is to log all priorities. The function ``LOG_MASK(pri)`` calculates the mask for the individual priority *pri*. The function ``LOG_UPTO(pri)`` calculates the mask for all priorities up to and including diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst index 00664cfbe8d6233..8651844170d70a8 100644 --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -34,7 +34,8 @@ Standard Annex #44, `"Unicode Character Database" **Numeric values** ------------------------------------------------------------------------------------------------------------------------- -:func:`decimal(chr) ` Decimal value of a character +:func:`decimal(chr) ` Decimal value of a + character :func:`digit(chr) ` Digit value of a character :func:`numeric(chr) ` Numeric value of a character diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst index 43ab19037d26273..e7cb5fd80153a06 100644 --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1941,7 +1941,8 @@ Support for a port to IBM's OS/2 using the EMX runtime environment was merged into the main Python source tree. EMX is a POSIX emulation layer over the OS/2 system APIs. The Python port for EMX tries to support all the POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:`!fork` and -:func:`fcntl` are restricted by the limitations of the underlying emulation +:func:`~fcntl.fcntl` are restricted by the limitations of the underlying +emulation layer. The standard OS/2 port, which uses IBM's Visual Age compiler, also gained support for case-sensitive import semantics as part of the integration of the EMX port into CVS. (Contributed by Andrew MacIntyre.) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index f66382a704b323c..e90f4b7e251069b 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -2622,7 +2622,8 @@ changes, or look through the Subversion logs for all the details. intended for testing purposes that lets you temporarily modify the warning filters and then restore their original values (:issue:`3781`). -* The XML-RPC :class:`SimpleXMLRPCServer ` and :class:`DocXMLRPCServer ` +* The XML-RPC :class:`~xmlrpc.server.SimpleXMLRPCServer` and + :class:`~xmlrpc.server.DocXMLRPCServer` classes can now be prevented from immediately opening and binding to their socket by passing ``False`` as the *bind_and_activate* constructor parameter. This can be used to modify the instance's diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index dbc6ad9f56a0639..b9c67effeeb0ddc 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -2708,7 +2708,8 @@ require changes to your code: (Discovered by David Beazley and fixed by Victor Stinner; :issue:`10783`.) -* The :class:`xml.etree.ElementTree` class now raises an +* The :class:`xml.etree.ElementTree ` class + now raises an :exc:`xml.etree.ElementTree.ParseError` when a parse fails. Previously it raised an :exc:`xml.parsers.expat.ExpatError`. diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index 0067491c569cc05..273cbe7ff925a0b 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -440,7 +440,7 @@ Some smaller changes made to the core Python language are: references to local variables from the frame. (Contributed by Antoine Pitrou in :issue:`17934`.) -* :class:`memoryview` is now registered as a :class:`Sequence `, +* :class:`memoryview` is now registered as a :class:`~collections.abc.Sequence`, and supports the :func:`reversed` builtin. (Contributed by Nick Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.) From d1c3e1c8567493e4ca295e42685e78d0e5cbd46a Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Thu, 29 Oct 2026 08:56:05 +0000 Subject: [PATCH 2/2] rewrap --- Doc/library/ctypes.rst | 5 ++-- Doc/library/datetime.rst | 5 ++-- Doc/library/getopt.rst | 8 ++---- Doc/library/getpass.rst | 7 ++--- Doc/library/gettext.rst | 4 +-- Doc/library/marshal.rst | 3 +- Doc/library/mmap.rst | 9 +++--- Doc/library/multiprocessing.rst | 8 +++--- Doc/library/multiprocessing.shared_memory.rst | 14 +++++----- Doc/library/optparse.rst | 7 ++--- Doc/library/random.rst | 5 ++-- Doc/library/shlex.rst | 19 ++++++------- Doc/library/signal.rst | 3 +- Doc/library/sys.rst | 3 +- Doc/library/syslog.rst | 28 ++++++++----------- Doc/whatsnew/2.3.rst | 7 ++--- Doc/whatsnew/2.6.rst | 17 ++++++----- Doc/whatsnew/3.2.rst | 5 ++-- 18 files changed, 68 insertions(+), 89 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index f081962c911fc22..e4021e982825e81 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -3759,9 +3759,8 @@ fields, or any other data types containing pointer type fields. :module: ctypes.util Information regarding a structure field defined by the - :func:`~ctypes.util.struct` - decorator. This should be used in the second argument of a - :class:`typing.Annotated` wrapping a ctypes type. + :func:`~ctypes.util.struct` decorator. This should be used in the second + argument of a :class:`typing.Annotated` wrapping a ctypes type. *anonymous* specifies whether the field will be present in the :attr:`~ctypes.Structure._anonymous_` attribute of the generated class. diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index fe3309881cb6a2e..552626cbb8ac88e 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1387,9 +1387,8 @@ Instance methods: tzinfo=self.tzinfo, *, fold=0) Return a new :class:`~datetime.datetime` object with the same attributes, but - with - specified parameters updated. Note that ``tzinfo=None`` can be specified to - create a naive datetime from an aware datetime with no conversion of date + with specified parameters updated. Note that ``tzinfo=None`` can be specified + to create a naive datetime from an aware datetime with no conversion of date and time data. :class:`.datetime` objects are also supported by generic function diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst index f732e7918723552..7d8a151534a4d17 100644 --- a/Doc/library/getopt.rst +++ b/Doc/library/getopt.rst @@ -81,11 +81,9 @@ exception: .. function:: gnu_getopt(args, shortopts, longopts=[]) This function works like :func:`~getopt.getopt`, except that GNU style - scanning mode is - used by default. This means that option and non-option arguments may be - intermixed. The :func:`~getopt.getopt` function stops processing options as - soon as a - non-option argument is encountered. + scanning mode is used by default. This means that option and non-option + arguments may be intermixed. The :func:`~getopt.getopt` function stops + processing options as soon as a non-option argument is encountered. If the first character of the option string is ``'+'``, or if the environment variable :envvar:`!POSIXLY_CORRECT` is set, then option processing stops as diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst index 73270e418d9d4d1..0f687bb242335a3 100644 --- a/Doc/library/getpass.rst +++ b/Doc/library/getpass.rst @@ -28,14 +28,13 @@ The :mod:`!getpass` module provides two functions: display asterisks instead of the actual input. If echo-free input is unavailable, :func:`~getpass.getpass` falls back to - printing - a warning message to *stream* and reading from :data:`sys.stdin` and + printing a warning message to *stream* and reading from :data:`sys.stdin` and issuing a :exc:`GetPassWarning`. .. note:: If you call :func:`~getpass.getpass` from within IDLE, the input may be - done in the - terminal you launched IDLE from rather than the idle window itself. + done in the terminal you launched IDLE from rather than the idle window + itself. .. note:: On Unix systems, when *echo_char* is set, the terminal will be diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst index 9d0e9b01b6a327b..7d012b062c304a7 100644 --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -90,8 +90,8 @@ class-based API instead. Similar to the corresponding functions without the ``p`` in the prefix (that is, :func:`~gettext.gettext`, :func:`dgettext`, :func:`ngettext`, - :func:`dngettext`), - but the translation is restricted to the given message *context*. + :func:`dngettext`), but the translation is restricted to the given message + *context*. .. versionadded:: 3.8 diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst index 07ad895230342f6..a5622ac5138a83c 100644 --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -59,8 +59,7 @@ this module. The following types are supported: Recursive containers are supported since :data:`version` 3. * The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration`. * :class:`code ` objects, if *allow_code* is true. See note - above about - version dependence. + above about version dependence. .. versionchanged:: 3.4 diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index ef4efd7d9fb7d69..5f2b74a8538a754 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -426,11 +426,10 @@ PROT_* constants PROT_EXEC Memory protection flags accepted by the *prot* argument of - :class:`~mmap.mmap`. - :const:`PROT_READ` allows pages to be read, :const:`PROT_WRITE` allows pages - to be written, and :const:`PROT_EXEC` allows pages to be executed. Values - can be combined using the bitwise OR operator. Not every option is present - on every system. + :class:`~mmap.mmap`. :const:`PROT_READ` allows pages to be read, + :const:`PROT_WRITE` allows pages to be written, and :const:`PROT_EXEC` allows + pages to be executed. Values can be combined using the bitwise OR operator. + Not every option is present on every system. .. availability:: Unix. diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index f96c90e331c0f3e..cd376bd49f43eda 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2463,10 +2463,10 @@ with the :class:`Pool` class. .. warning:: :class:`~multiprocessing.pool.Pool` objects have internal resources that - need to be - properly managed (like any other resource) by using the pool as a context manager - or by calling :meth:`close` and :meth:`terminate` manually. Failure to do this - can lead to the process hanging on finalization. + need to be properly managed (like any other resource) by using the pool as + a context manager or by calling :meth:`close` and :meth:`terminate` + manually. Failure to do this can lead to the process hanging on + finalization. Note that it is **not correct** to rely on the garbage collector to destroy the pool as CPython does not assure that the finalizer of the pool will be called diff --git a/Doc/library/multiprocessing.shared_memory.rst b/Doc/library/multiprocessing.shared_memory.rst index 27689a172468028..a330b114fcc59f8 100644 --- a/Doc/library/multiprocessing.shared_memory.rst +++ b/Doc/library/multiprocessing.shared_memory.rst @@ -223,9 +223,9 @@ same :class:`!numpy.ndarray` from two distinct Python shells: This class provides methods for creating and returning :class:`~multiprocessing.shared_memory.SharedMemory` instances and for - creating - a list-like object (:class:`~multiprocessing.shared_memory.ShareableList`) - backed by shared memory. + creating a list-like object + (:class:`~multiprocessing.shared_memory.ShareableList`) backed by shared + memory. Refer to :class:`~multiprocessing.managers.BaseManager` for a description of the inherited *address* and *authkey* optional input arguments and how @@ -235,14 +235,14 @@ same :class:`!numpy.ndarray` from two distinct Python shells: .. method:: SharedMemory(size) Create and return a new - :class:`~multiprocessing.shared_memory.SharedMemory` - object with the specified *size* in bytes. + :class:`~multiprocessing.shared_memory.SharedMemory` object with the + specified *size* in bytes. .. method:: ShareableList(sequence) Create and return a new - :class:`~multiprocessing.shared_memory.ShareableList` - object, initialized by the values from the input *sequence*. + :class:`~multiprocessing.shared_memory.ShareableList` object, initialized + by the values from the input *sequence*. The following example demonstrates the basic mechanisms of a diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst index c36503ac47b445d..b593ba5f5df02e3 100644 --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -2041,10 +2041,9 @@ Finally, the Option subclass:: TYPE_CHECKER["complex"] = check_complex (If we didn't make a :func:`~copy.copy` of :attr:`Option.TYPE_CHECKER`, we would -end -up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:`!optparse`'s -Option class. This being Python, nothing stops you from doing that except good -manners and common sense.) +end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of +:mod:`!optparse`'s Option class. This being Python, nothing stops you from +doing that except good manners and common sense.) That's it! Now you can write a script that uses the new option type just like any other :mod:`!optparse`\ -based script, except you have to instruct your diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 8ef5ba4de2809b6..35795cde95d56ff 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -194,9 +194,8 @@ Functions for sequences The *weights* or *cum_weights* can use any numeric type that interoperates with the :class:`float` values returned by :func:`~random.random` (that - includes - integers, floats, and fractions but excludes decimals). Weights are assumed - to be non-negative and finite. A :exc:`ValueError` is raised if all + includes integers, floats, and fractions but excludes decimals). Weights are + assumed to be non-negative and finite. A :exc:`ValueError` is raised if all weights are zero. For a given seed, the :func:`choices` function with equal weighting diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst index e2ce18542e7a360..1065dc0a4e5fb17 100644 --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -412,16 +412,15 @@ Improved Compatibility with Shells .. versionadded:: 3.6 The :class:`~shlex.shlex` class provides compatibility with the parsing -performed by -common Unix shells like ``bash``, ``dash``, and ``sh``. To take advantage of -this compatibility, specify the ``punctuation_chars`` argument in the -constructor. This defaults to ``False``, which preserves pre-3.6 behaviour. -However, if it is set to ``True``, then parsing of the characters ``();<>|&`` -is changed: any run of these characters is returned as a single token. While -this is short of a full parser for shells (which would be out of scope for the -standard library, given the multiplicity of shells out there), it does allow -you to perform processing of command lines more easily than you could -otherwise. To illustrate, you can see the difference in the following snippet: +performed by common Unix shells like ``bash``, ``dash``, and ``sh``. To take +advantage of this compatibility, specify the ``punctuation_chars`` argument in +the constructor. This defaults to ``False``, which preserves pre-3.6 behaviour. +However, if it is set to ``True``, then parsing of the characters ``();<>|&`` is +changed: any run of these characters is returned as a single token. While this +is short of a full parser for shells (which would be out of scope for the +standard library, given the multiplicity of shells out there), it does allow you +to perform processing of command lines more easily than you could otherwise. To +illustrate, you can see the difference in the following snippet: .. doctest:: :options: +NORMALIZE_WHITESPACE diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst index e6cf11dcf7cb57f..8bbe7901d3e17d5 100644 --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -605,8 +605,7 @@ The :mod:`!signal` module defines the following functions: See the man page :manpage:`siginterrupt(3)` for further information. Note that installing a signal handler with :func:`~signal.signal` will reset - the - restart behaviour to interruptible by implicitly calling + the restart behaviour to interruptible by implicitly calling :c:func:`!siginterrupt` with a true *flag* value for the given signal. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 5ed0048d4369ace..ae747446025467e 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -593,8 +593,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only program when an error occurs. Since :func:`~sys.exit` ultimately "only" raises an exception, it will only - exit - the process when called from the main thread, and the exception is not + exit the process when called from the main thread, and the exception is not intercepted. Cleanup actions specified by :keyword:`finally` clauses of :keyword:`try` statements are honored, and it is possible to intercept the exit attempt at an outer level. diff --git a/Doc/library/syslog.rst b/Doc/library/syslog.rst index 8b4e5a657085ea0..cf6823733d70027 100644 --- a/Doc/library/syslog.rst +++ b/Doc/library/syslog.rst @@ -30,33 +30,29 @@ The module defines the following functions: value given in the :func:`openlog` call is used. If :func:`openlog` has not been called prior to the call to - :func:`~syslog.syslog`, - :func:`openlog` will be called with no arguments. + :func:`~syslog.syslog`, :func:`openlog` will be called with no arguments. .. audit-event:: syslog.syslog priority,message syslog.syslog .. versionchanged:: 3.2 In previous versions, :func:`openlog` would not be called automatically if it wasn't called prior to the call to :func:`~syslog.syslog`, deferring to - the syslog - implementation to call ``openlog()``. + the syslog implementation to call ``openlog()``. .. versionchanged:: 3.12 This function is restricted in subinterpreters. (Only code that runs in multiple interpreters is affected and the restriction is not relevant for most users.) :func:`openlog` must be called in the main interpreter before - :func:`~syslog.syslog` may be used - in a subinterpreter. Otherwise it will raise :exc:`RuntimeError`. + :func:`~syslog.syslog` may be used in a subinterpreter. Otherwise it will + raise :exc:`RuntimeError`. .. function:: openlog([ident[, logoption[, facility]]]) Logging options of subsequent :func:`~syslog.syslog` calls can be set by - calling - :func:`openlog`. :func:`~syslog.syslog` will call :func:`openlog` with no - arguments - if the log is not currently open. + calling :func:`openlog`. :func:`~syslog.syslog` will call :func:`openlog` + with no arguments if the log is not currently open. The optional *ident* keyword argument is a string which is prepended to every message, and defaults to ``sys.argv[0]`` with leading path components @@ -85,8 +81,7 @@ The module defines the following functions: This causes the module to behave as it does when initially imported. For example, :func:`openlog` will be called on the first :func:`~syslog.syslog` - call (if - :func:`openlog` hasn't already been called), and *ident* and other + call (if :func:`openlog` hasn't already been called), and *ident* and other :func:`openlog` parameters are reset to defaults. .. audit-event:: syslog.closelog "" syslog.closelog @@ -103,11 +98,10 @@ The module defines the following functions: Set the priority mask to *maskpri* and return the previous mask value. Calls to :func:`~syslog.syslog` with a priority level not set in *maskpri* are - ignored. - The default is to log all priorities. The function ``LOG_MASK(pri)`` - calculates the mask for the individual priority *pri*. The function - ``LOG_UPTO(pri)`` calculates the mask for all priorities up to and including - *pri*. + ignored. The default is to log all priorities. The function + ``LOG_MASK(pri)`` calculates the mask for the individual priority *pri*. The + function ``LOG_UPTO(pri)`` calculates the mask for all priorities up to and + including *pri*. .. audit-event:: syslog.setlogmask maskpri syslog.setlogmask diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst index e7cb5fd80153a06..f2d372440717517 100644 --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1942,10 +1942,9 @@ into the main Python source tree. EMX is a POSIX emulation layer over the OS/2 system APIs. The Python port for EMX tries to support all the POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:`!fork` and :func:`~fcntl.fcntl` are restricted by the limitations of the underlying -emulation -layer. The standard OS/2 port, which uses IBM's Visual Age compiler, also -gained support for case-sensitive import semantics as part of the integration of -the EMX port into CVS. (Contributed by Andrew MacIntyre.) +emulation layer. The standard OS/2 port, which uses IBM's Visual Age compiler, +also gained support for case-sensitive import semantics as part of the +integration of the EMX port into CVS. (Contributed by Andrew MacIntyre.) On MacOS, most toolbox modules have been weaklinked to improve backward compatibility. This means that modules will no longer fail to load if a single diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index e90f4b7e251069b..d8c0677bc3cfce6 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -2623,15 +2623,14 @@ changes, or look through the Subversion logs for all the details. warning filters and then restore their original values (:issue:`3781`). * The XML-RPC :class:`~xmlrpc.server.SimpleXMLRPCServer` and - :class:`~xmlrpc.server.DocXMLRPCServer` - classes can now be prevented from immediately opening and binding to - their socket by passing ``False`` as the *bind_and_activate* - constructor parameter. This can be used to modify the instance's - :attr:`~socketserver.BaseServer.allow_reuse_address` attribute before calling the - :meth:`~socketserver.BaseServer.server_bind` and - :meth:`~socketserver.BaseServer.server_activate` methods to - open the socket and begin listening for connections. - (Contributed by Peter Parente; :issue:`1599845`.) + :class:`~xmlrpc.server.DocXMLRPCServer` classes can now be prevented from + immediately opening and binding to their socket by passing ``False`` as the + *bind_and_activate* constructor parameter. This can be used to modify the + instance's :attr:`~socketserver.BaseServer.allow_reuse_address` attribute + before calling the :meth:`~socketserver.BaseServer.server_bind` and + :meth:`~socketserver.BaseServer.server_activate` methods to open the socket + and begin listening for connections. (Contributed by Peter Parente; + :issue:`1599845`.) :class:`~xmlrpc.server.SimpleXMLRPCServer` also has a :attr:`!_send_traceback_header` attribute; if true, the exception and formatted traceback are returned diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index b9c67effeeb0ddc..4626dee3fee873a 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -2709,9 +2709,8 @@ require changes to your code: (Discovered by David Beazley and fixed by Victor Stinner; :issue:`10783`.) * The :class:`xml.etree.ElementTree ` class - now raises an - :exc:`xml.etree.ElementTree.ParseError` when a parse fails. Previously it - raised an :exc:`xml.parsers.expat.ExpatError`. + now raises an :exc:`xml.etree.ElementTree.ParseError` when a parse fails. + Previously it raised an :exc:`xml.parsers.expat.ExpatError`. * The new, longer :func:`str` value on floats may break doctests which rely on the old output format.