Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 317f39b

Browse files
committed
gh-100989: Fix regression in docstrings of collections.deque
1 parent 0f2ba65 commit 317f39b

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

Modules/_collectionsmodule.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ deque_rotate(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
910910
}
911911

912912
PyDoc_STRVAR(rotate_doc,
913-
"rotate(n)\n\n"
913+
"rotate(n)\n"
914914
"Rotate the deque *n* steps to the right (default ``n=1``). "
915915
"If *n* is negative, rotates left.");
916916

@@ -953,7 +953,7 @@ deque_reverse(dequeobject *deque, PyObject *unused)
953953
}
954954

955955
PyDoc_STRVAR(reverse_doc,
956-
"reverse()\n\n"
956+
"reverse()\n"
957957
"Reverse the elements of the deque *IN PLACE*.");
958958

959959
static PyObject *
@@ -993,7 +993,7 @@ deque_count(dequeobject *deque, PyObject *v)
993993
}
994994

995995
PyDoc_STRVAR(count_doc,
996-
"count(x) -> int\n\n"
996+
"count(x) -> int\n"
997997
"Count the number of deque elements equal to *x*.");
998998

999999
static int
@@ -1102,10 +1102,9 @@ deque_index(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
11021102
}
11031103

11041104
PyDoc_STRVAR(index_doc,
1105-
"index(x, [start, [stop]]) -> int\n\n"
1106-
"Return the position of *x* in the deque "
1107-
"(at or after index *start* and before index *stop*). "
1108-
"Returns the first match or raises a ValueError if not found.");
1105+
"index(x, [start, [stop]]) -> int\n"
1106+
"Return first index of *x*. "
1107+
"Raises ValueError if *x* is not present.");
11091108

11101109
/* insert(), remove(), and delitem() are implemented in terms of
11111110
rotate() for simplicity and reasonable performance near the end
@@ -1150,11 +1149,11 @@ deque_insert(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
11501149
}
11511150

11521151
PyDoc_STRVAR(insert_doc,
1153-
"insert(i, x)\n\n"
1152+
"insert(i, x)\n"
11541153
"Insert *x* into the deque at position *i*.");
11551154

11561155
PyDoc_STRVAR(remove_doc,
1157-
"remove(x)\n\n"
1156+
"remove(x)\n"
11581157
"Remove the first occurrence of *x*."
11591158
"If not found, raises a ValueError.");
11601159

@@ -1527,7 +1526,7 @@ deque_sizeof(dequeobject *deque, void *unused)
15271526
}
15281527

15291528
PyDoc_STRVAR(sizeof_doc,
1530-
"__sizeof__() -> int\n\n"
1529+
"__sizeof__() -> int\n"
15311530
"Size of the deque in memory, in bytes.");
15321531

15331532
static PyObject *
@@ -1563,7 +1562,7 @@ static PySequenceMethods deque_as_sequence = {
15631562
static PyObject *deque_iter(dequeobject *deque);
15641563
static PyObject *deque_reviter(dequeobject *deque, PyObject *Py_UNUSED(ignored));
15651564
PyDoc_STRVAR(reversed_doc,
1566-
"__reversed__()\n\n"
1565+
"__reversed__()\n"
15671566
"Return a reverse iterator over the deque.");
15681567

15691568
static PyMethodDef deque_methods[] = {
@@ -1609,7 +1608,7 @@ static PyMethodDef deque_methods[] = {
16091608
};
16101609

16111610
PyDoc_STRVAR(deque_doc,
1612-
"deque([iterable[, maxlen]]) -> collections.deque\n\n"
1611+
"deque([iterable[, maxlen]]) -> collections.deque\n"
16131612
"A list-like sequence optimized for data accesses near its endpoints.");
16141613

16151614
static PyTypeObject deque_type = {
@@ -1989,7 +1988,7 @@ new_defdict(defdictobject *dd, PyObject *arg)
19891988
dd->default_factory ? dd->default_factory : Py_None, arg, NULL);
19901989
}
19911990

1992-
PyDoc_STRVAR(defdict_copy_doc, "copy() -> collections.deque\n\n"
1991+
PyDoc_STRVAR(defdict_copy_doc, "copy() -> collections.deque\n"
19931992
"A shallow copy of the deque.");
19941993

19951994
static PyObject *

0 commit comments

Comments
 (0)