Skip to content

Commit 46d10b1

Browse files
authored
bpo-40204: Fix duplicates in the documentation (GH-21857)
Fix two Sphinx 3 issues: Doc/c-api/buffer.rst:304: WARNING: Duplicate C declaration, also defined in 'c-api/buffer'. Declaration is 'PyBUF_ND'. Doc/c-api/unicode.rst:1603: WARNING: Duplicate C declaration, also defined in 'c-api/unicode'. Declaration is 'PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)'.
1 parent 43577c0 commit 46d10b1

File tree

2 files changed

+13
-26
lines changed

2 files changed

+13
-26
lines changed

Doc/c-api/buffer.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ must be C-contiguous.
301301
+-----------------------------------+-------+---------+------------+--------+
302302
| .. c:macro:: PyBUF_ANY_CONTIGUOUS | yes | yes | NULL | C or F |
303303
+-----------------------------------+-------+---------+------------+--------+
304-
| .. c:macro:: PyBUF_ND | yes | NULL | NULL | C |
304+
| :c:macro:`PyBUF_ND` | yes | NULL | NULL | C |
305305
+-----------------------------------+-------+---------+------------+--------+
306306

307307

Doc/c-api/unicode.rst

+12-25
Original file line numberDiff line numberDiff line change
@@ -1487,17 +1487,21 @@ These are the mapping codec APIs:
14871487
14881488
The following codec API is special in that maps Unicode to Unicode.
14891489
1490-
.. c:function:: PyObject* PyUnicode_Translate(PyObject *unicode, \
1491-
PyObject *mapping, const char *errors)
1490+
.. c:function:: PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)
14921491
1493-
Translate a Unicode object using the given *mapping* object and return the
1494-
resulting Unicode object. Return ``NULL`` if an exception was raised by the
1492+
Translate a string by applying a character mapping table to it and return the
1493+
resulting Unicode object. Return ``NULL`` if an exception was raised by the
14951494
codec.
14961495
1497-
The *mapping* object must map Unicode ordinal integers to Unicode strings,
1498-
integers (which are then interpreted as Unicode ordinals) or ``None``
1499-
(causing deletion of the character). Unmapped character ordinals (ones
1500-
which cause a :exc:`LookupError`) are left untouched and are copied as-is.
1496+
The mapping table must map Unicode ordinal integers to Unicode ordinal integers
1497+
or ``None`` (causing deletion of the character).
1498+
1499+
Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
1500+
and sequences work well. Unmapped character ordinals (ones which cause a
1501+
:exc:`LookupError`) are left untouched and are copied as-is.
1502+
1503+
*errors* has the usual meaning for codecs. It may be ``NULL`` which indicates to
1504+
use the default error handling.
15011505
15021506
15031507
.. c:function:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, \
@@ -1600,23 +1604,6 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
16001604
characters are not included in the resulting strings.
16011605
16021606
1603-
.. c:function:: PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, \
1604-
const char *errors)
1605-
1606-
Translate a string by applying a character mapping table to it and return the
1607-
resulting Unicode object.
1608-
1609-
The mapping table must map Unicode ordinal integers to Unicode ordinal integers
1610-
or ``None`` (causing deletion of the character).
1611-
1612-
Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
1613-
and sequences work well. Unmapped character ordinals (ones which cause a
1614-
:exc:`LookupError`) are left untouched and are copied as-is.
1615-
1616-
*errors* has the usual meaning for codecs. It may be ``NULL`` which indicates to
1617-
use the default error handling.
1618-
1619-
16201607
.. c:function:: PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq)
16211608
16221609
Join a sequence of strings using the given *separator* and return the resulting

0 commit comments

Comments
 (0)