Skip to content

Commit 33c8a16

Browse files
hugovkGlyphack
authored andcommitted
pythongh-101100: Fix Sphinx reference warnings (pythonGH-112416)
* Fix Sphinx warning in library/xml.rst Direct use of the pyexpat module is deprecated, but this is how to check the version for security purposes * Fix Sphinx warning in library/importlib.resources.rst * Use italics for parameters * Link to the exception * Fix Sphinx warning in library/gzip.rst * Document message and header defect base classes to fix Sphinx warning in library/email.headerregistry.rst * Restore feed_eof() doc to fix Sphinx warning in library/asyncio-stream.rst * Fix Sphinx warning in extending/newtypes.rst * Fix Sphinx warning in c-api/set.rst On stdtypes.rst, set and frozenset are documented together and the frozenset has the working refs
1 parent 1cb25c0 commit 33c8a16

File tree

8 files changed

+23
-17
lines changed

8 files changed

+23
-17
lines changed

Doc/c-api/set.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
147147
148148
Return ``1`` if found and removed, ``0`` if not found (no action taken), and ``-1`` if an
149149
error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a
150-
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard`
150+
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~frozenset.discard`
151151
method, this function does not automatically convert unhashable sets into
152152
temporary frozensets. Raise :exc:`SystemError` if *set* is not an
153153
instance of :class:`set` or its subtype.

Doc/extending/newtypes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` table
296296
descriptors that are used at runtime is that any attribute defined this way can
297297
have an associated doc string simply by providing the text in the table. An
298298
application can use the introspection API to retrieve the descriptor from the
299-
class object, and get the doc string using its :attr:`__doc__` attribute.
299+
class object, and get the doc string using its :attr:`!__doc__` attribute.
300300

301301
As with the :c:member:`~PyTypeObject.tp_methods` table, a sentinel entry with a :c:member:`~PyMethodDef.ml_name` value
302302
of ``NULL`` is required.

Doc/library/asyncio-stream.rst

+4
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ StreamReader
204204
directly; use :func:`open_connection` and :func:`start_server`
205205
instead.
206206

207+
.. method:: feed_eof()
208+
209+
Acknowledge the EOF.
210+
207211
.. coroutinemethod:: read(n=-1)
208212

209213
Read up to *n* bytes from the stream.

Doc/library/email.errors.rst

+9
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ The following exception classes are defined in the :mod:`email.errors` module:
5858
:class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g.
5959
:class:`~email.mime.image.MIMEImage`).
6060

61+
.. exception:: MessageDefect()
62+
63+
This is the base class for all defects found when parsing email messages.
64+
It is derived from :exc:`ValueError`.
65+
66+
.. exception:: HeaderDefect()
67+
68+
This is the base class for all defects found when parsing email headers.
69+
It is derived from :exc:`MessageDefect`.
6170

6271
Here is the list of the defects that the :class:`~email.parser.FeedParser`
6372
can find while parsing messages. Note that the defects are added to the message

Doc/library/gzip.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The module defines the following items:
105105
should only be provided in compression mode. If omitted or ``None``, the
106106
current time is used. See the :attr:`mtime` attribute for more details.
107107

108-
Calling a :class:`GzipFile` object's :meth:`close` method does not close
108+
Calling a :class:`GzipFile` object's :meth:`!close` method does not close
109109
*fileobj*, since you might wish to append more material after the compressed
110110
data. This also allows you to pass an :class:`io.BytesIO` object opened for
111111
writing as *fileobj*, and retrieve the resulting memory buffer using the

Doc/library/importlib.resources.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ for example, a package and its resources can be imported from a zip file using
5050
``get_resource_reader(fullname)`` method as specified by
5151
:class:`importlib.resources.abc.ResourceReader`.
5252

53-
.. data:: Anchor
53+
.. class:: Anchor
5454

5555
Represents an anchor for resources, either a :class:`module object
5656
<types.ModuleType>` or a module name as a string. Defined as
@@ -63,7 +63,7 @@ for example, a package and its resources can be imported from a zip file using
6363
(think files). A Traversable may contain other containers (think
6464
subdirectories).
6565

66-
*anchor* is an optional :data:`Anchor`. If the anchor is a
66+
*anchor* is an optional :class:`Anchor`. If the anchor is a
6767
package, resources are resolved from that package. If a module,
6868
resources are resolved adjacent to that module (in the same package
6969
or the package root). If the anchor is omitted, the caller's module
@@ -72,10 +72,10 @@ for example, a package and its resources can be imported from a zip file using
7272
.. versionadded:: 3.9
7373

7474
.. versionchanged:: 3.12
75-
"package" parameter was renamed to "anchor". "anchor" can now
75+
*package* parameter was renamed to *anchor*. *anchor* can now
7676
be a non-package module and if omitted will default to the caller's
77-
module. "package" is still accepted for compatibility but will raise
78-
a DeprecationWarning. Consider passing the anchor positionally or
77+
module. *package* is still accepted for compatibility but will raise
78+
a :exc:`DeprecationWarning`. Consider passing the anchor positionally or
7979
using ``importlib_resources >= 5.10`` for a compatible interface
8080
on older Pythons.
8181

@@ -96,4 +96,4 @@ for example, a package and its resources can be imported from a zip file using
9696
.. versionadded:: 3.9
9797

9898
.. versionchanged:: 3.12
99-
Added support for ``traversable`` representing a directory.
99+
Added support for *traversable* representing a directory.

Doc/library/xml.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ decompression bomb Safe Safe Safe
7373
1. Expat 2.4.1 and newer is not vulnerable to the "billion laughs" and
7474
"quadratic blowup" vulnerabilities. Items still listed as vulnerable due to
7575
potential reliance on system-provided libraries. Check
76-
:const:`pyexpat.EXPAT_VERSION`.
76+
:const:`!pyexpat.EXPAT_VERSION`.
7777
2. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a
7878
:exc:`~xml.etree.ElementTree.ParseError` when an entity occurs.
7979
3. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns

Doc/tools/.nitignore

-7
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ Doc/c-api/memory.rst
1414
Doc/c-api/memoryview.rst
1515
Doc/c-api/module.rst
1616
Doc/c-api/object.rst
17-
Doc/c-api/set.rst
1817
Doc/c-api/stable.rst
1918
Doc/c-api/structures.rst
2019
Doc/c-api/sys.rst
2120
Doc/c-api/type.rst
2221
Doc/c-api/typeobj.rst
2322
Doc/extending/extending.rst
24-
Doc/extending/newtypes.rst
2523
Doc/glossary.rst
2624
Doc/howto/descriptor.rst
2725
Doc/howto/enum.rst
@@ -32,7 +30,6 @@ Doc/library/abc.rst
3230
Doc/library/ast.rst
3331
Doc/library/asyncio-extending.rst
3432
Doc/library/asyncio-policy.rst
35-
Doc/library/asyncio-stream.rst
3633
Doc/library/asyncio-subprocess.rst
3734
Doc/library/asyncio-task.rst
3835
Doc/library/bdb.rst
@@ -51,7 +48,6 @@ Doc/library/decimal.rst
5148
Doc/library/email.charset.rst
5249
Doc/library/email.compat32-message.rst
5350
Doc/library/email.errors.rst
54-
Doc/library/email.headerregistry.rst
5551
Doc/library/email.mime.rst
5652
Doc/library/email.parser.rst
5753
Doc/library/email.policy.rst
@@ -63,12 +59,10 @@ Doc/library/ftplib.rst
6359
Doc/library/functions.rst
6460
Doc/library/functools.rst
6561
Doc/library/gettext.rst
66-
Doc/library/gzip.rst
6762
Doc/library/http.client.rst
6863
Doc/library/http.cookiejar.rst
6964
Doc/library/http.cookies.rst
7065
Doc/library/http.server.rst
71-
Doc/library/importlib.resources.rst
7266
Doc/library/importlib.rst
7367
Doc/library/inspect.rst
7468
Doc/library/locale.rst
@@ -122,7 +116,6 @@ Doc/library/wsgiref.rst
122116
Doc/library/xml.dom.minidom.rst
123117
Doc/library/xml.dom.pulldom.rst
124118
Doc/library/xml.dom.rst
125-
Doc/library/xml.rst
126119
Doc/library/xml.sax.handler.rst
127120
Doc/library/xml.sax.reader.rst
128121
Doc/library/xml.sax.rst

0 commit comments

Comments
 (0)