diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 54ab05e4e66549..b21c142cd80666 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -93,7 +93,7 @@ The :mod:`!datetime` module exports the following constants: The largest year number allowed in a :class:`date` or :class:`.datetime` object. :const:`MAXYEAR` is 9999. -.. attribute:: UTC +.. data:: UTC Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`. @@ -918,7 +918,7 @@ Other constructors, all class methods: .. deprecated:: 3.12 - Use :meth:`datetime.now` with :attr:`UTC` instead. + Use :meth:`datetime.now` with :const:`UTC` instead. .. classmethod:: datetime.fromtimestamp(timestamp, tz=None) @@ -990,7 +990,7 @@ Other constructors, all class methods: .. deprecated:: 3.12 - Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead. + Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead. .. classmethod:: datetime.fromordinal(ordinal) diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 2ce4c913ff4364..654451f7f27734 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -2245,7 +2245,7 @@ value for :attr:`~Context.prec` as well [#]_:: Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312') -For inexact results, :attr:`MAX_PREC` is far too large on 64-bit platforms and +For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms and the available memory will be insufficient:: >>> Decimal(1) / 3 diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst index 73327744b67041..4106419fbb7763 100644 --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -184,7 +184,7 @@ The :class:`dircmp` class are the same type as *self*, if *self* is a subclass of :class:`dircmp`. -.. attribute:: DEFAULT_IGNORES +.. data:: DEFAULT_IGNORES .. versionadded:: 3.4 diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst index 289e02ccdc153c..4b9b4ca939fc11 100644 --- a/Doc/library/importlib.metadata.rst +++ b/Doc/library/importlib.metadata.rst @@ -373,7 +373,7 @@ Mapping import to distribution packages .. function:: packages_distributions() Return a mapping from the top level module and import package - names found via :attr:`sys.meta_path` to the names of the distribution + names found via :data:`sys.meta_path` to the names of the distribution packages (if any) that provide the corresponding files. To allow for namespace packages (which may have members provided by diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 0fe58549bdac3f..43da7146ad0b40 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -746,7 +746,7 @@ ABC hierarchy:: suitable for reading (same as :attr:`pathlib.Path.open`). When opening as text, accepts encoding parameters such as those - accepted by :attr:`io.TextIOWrapper`. + accepted by :class:`io.TextIOWrapper`. .. method:: read_bytes() @@ -794,14 +794,14 @@ ABC hierarchy:: This module contains the various objects that help :keyword:`import` find and load modules. -.. attribute:: SOURCE_SUFFIXES +.. data:: SOURCE_SUFFIXES A list of strings representing the recognized file suffixes for source modules. .. versionadded:: 3.3 -.. attribute:: DEBUG_BYTECODE_SUFFIXES +.. data:: DEBUG_BYTECODE_SUFFIXES A list of strings representing the file suffixes for non-optimized bytecode modules. @@ -809,9 +809,9 @@ find and load modules. .. versionadded:: 3.3 .. deprecated:: 3.5 - Use :attr:`BYTECODE_SUFFIXES` instead. + Use :const:`BYTECODE_SUFFIXES` instead. -.. attribute:: OPTIMIZED_BYTECODE_SUFFIXES +.. data:: OPTIMIZED_BYTECODE_SUFFIXES A list of strings representing the file suffixes for optimized bytecode modules. @@ -819,9 +819,9 @@ find and load modules. .. versionadded:: 3.3 .. deprecated:: 3.5 - Use :attr:`BYTECODE_SUFFIXES` instead. + Use :const:`BYTECODE_SUFFIXES` instead. -.. attribute:: BYTECODE_SUFFIXES +.. data:: BYTECODE_SUFFIXES A list of strings representing the recognized file suffixes for bytecode modules (including the leading dot). @@ -831,7 +831,7 @@ find and load modules. .. versionchanged:: 3.5 The value is no longer dependent on ``__debug__``. -.. attribute:: EXTENSION_SUFFIXES +.. data:: EXTENSION_SUFFIXES A list of strings representing the recognized file suffixes for extension modules. @@ -1109,7 +1109,7 @@ find and load modules. .. method:: is_package(fullname) Returns ``True`` if the file path points to a package's ``__init__`` - module based on :attr:`EXTENSION_SUFFIXES`. + module based on :const:`EXTENSION_SUFFIXES`. .. method:: get_code(fullname) @@ -1231,7 +1231,7 @@ find and load modules. This module contains the various objects that help in the construction of an :term:`importer`. -.. attribute:: MAGIC_NUMBER +.. data:: MAGIC_NUMBER The bytes which represent the bytecode version number. If you need help with loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`. diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 5d0bfcb113e4ff..22f135bbecd3a3 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -342,7 +342,7 @@ in a module, ``__name__`` is the module's name in the Python package namespace. If no handler is attached to this logger (or any of its ancestors, taking into account the relevant :attr:`Logger.propagate` attributes), - the message will be sent to the handler set on :attr:`lastResort`. + the message will be sent to the handler set on :data:`lastResort`. .. versionchanged:: 3.2 The *stack_info* parameter was added. @@ -1487,7 +1487,7 @@ functions. Module-Level Attributes ----------------------- -.. attribute:: lastResort +.. data:: lastResort A "handler of last resort" is available through this attribute. This is a :class:`StreamHandler` writing to ``sys.stderr`` with a level of @@ -1499,7 +1499,7 @@ Module-Level Attributes .. versionadded:: 3.2 -.. attribute:: raiseExceptions +.. data:: raiseExceptions Used to see if exceptions during handling should be propagated. diff --git a/Doc/library/select.rst b/Doc/library/select.rst index f23a249f44b485..bbac9bc4bbe3ee 100644 --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -165,7 +165,7 @@ The module defines the following: :exc:`InterruptedError`. -.. attribute:: PIPE_BUF +.. data:: PIPE_BUF The minimum number of bytes which can be written without blocking to a pipe when the pipe has been reported as ready for writing by :func:`~select.select`, diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index a154b4df7fedab..67360a5079fa05 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1886,8 +1886,8 @@ to speed up repeated connections from the same clients. A :class:`TLSVersion` enum member representing the highest supported TLS version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. - The attribute is read-only for protocols other than :attr:`PROTOCOL_TLS`, - :attr:`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`. + The attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, + :const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`. The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext.minimum_version` and @@ -1910,7 +1910,7 @@ to speed up repeated connections from the same clients. .. attribute:: SSLContext.num_tickets Control the number of TLS 1.3 session tickets of a - :attr:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS + :const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 connections. .. versionadded:: 3.8 diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst index 93a36e747b3a82..447de4c98ac3b3 100644 --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -353,7 +353,7 @@ convert them to Unicode using the ``mbcs`` encoding. Other systems also allow Unicode strings as file names but convert them to byte strings before passing them to the system, which can cause a :exc:`UnicodeError` to be raised. Applications can test whether arbitrary Unicode strings are -supported as file names by checking :attr:`os.path.supports_unicode_filenames`, +supported as file names by checking :const:`os.path.supports_unicode_filenames`, a Boolean value. Under MacOS, :func:`os.listdir` may now return Unicode filenames. diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index 1231bd76fd2ce2..78a7cf14cb8dda 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -1602,7 +1602,7 @@ changes, or look through the Subversion logs for all the details. identifier instead of the previous default value of ``'python'``. (Changed by Sean Reifschneider; :issue:`8451`.) -* The :attr:`sys.version_info` value is now a named tuple, with attributes +* The :data:`sys.version_info` value is now a named tuple, with attributes named :attr:`!major`, :attr:`!minor`, :attr:`!micro`, :attr:`!releaselevel`, and :attr:`!serial`. (Contributed by Ross Light; :issue:`4285`.) diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index ee347d2000d8dc..add932b47d7d35 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -1478,8 +1478,8 @@ imp ``imp.NullImporter`` Insert ``None`` into ``sys.path_importer_cache`` ``imp.cache_from_source()`` :func:`importlib.util.cache_from_source` ``imp.find_module()`` :func:`importlib.util.find_spec` - ``imp.get_magic()`` :attr:`importlib.util.MAGIC_NUMBER` - ``imp.get_suffixes()`` :attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery.EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES` + ``imp.get_magic()`` :const:`importlib.util.MAGIC_NUMBER` + ``imp.get_suffixes()`` :const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES` ``imp.get_tag()`` :attr:`sys.implementation.cache_tag ` ``imp.load_module()`` :func:`importlib.import_module` ``imp.new_module(name)`` ``types.ModuleType(name)`` diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index 6213915cc7413f..03704c0e6d698c 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -994,7 +994,7 @@ The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed by Berker Peksag in :issue:`18193`.) -:mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` attribute +:mod:`importlib.util` now has a :const:`~importlib.util.MAGIC_NUMBER` attribute providing access to the bytecode version number. This replaces the :func:`!get_magic` function in the deprecated :mod:`!imp` module. (Contributed by Brett Cannon in :issue:`18192`.) diff --git a/Misc/NEWS.d/3.11.0a4.rst b/Misc/NEWS.d/3.11.0a4.rst index 64e2f39ad9db18..a2d36202045887 100644 --- a/Misc/NEWS.d/3.11.0a4.rst +++ b/Misc/NEWS.d/3.11.0a4.rst @@ -775,8 +775,8 @@ Ensure that :func:`math.expm1` does not raise on underflow. .. nonce: s9PuyF .. section: Library -Adding :attr:`F_DUP2FD` and :attr:`F_DUP2FD_CLOEXEC` constants from FreeBSD -into the fcntl module. +Adding :const:`!F_DUP2FD` and :const:`!F_DUP2FD_CLOEXEC` constants from FreeBSD +into the :mod:`fcntl` module. ..