Skip to content

Commit f9c34a4

Browse files
Clean up
1 parent 2cc6393 commit f9c34a4

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

Modules/_collectionsmodule.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ static PyObject *
614614
deque_copy_impl(dequeobject *deque)
615615
/*[clinic end generated code: output=6409b3d1ad2898b5 input=51d2ed1a23bab5e2]*/
616616
{
617-
// TODO(Matthias): we can actually copy via memcpy, instead of using extend.
618617
PyObject *result;
619618
dequeobject *old_deque = deque;
620619
collections_state *state = find_module_state_by_def(Py_TYPE(deque));
@@ -864,7 +863,6 @@ deque_repeat(PyObject *self, Py_ssize_t n)
864863
return rv;
865864
}
866865

867-
// TODO(Matthias): Special case for length = allocated: we only need to move the first element, no memcpy.
868866
static int
869867
_deque_rotate(dequeobject *deque, Py_ssize_t n)
870868
{
@@ -1334,7 +1332,6 @@ deque_slice_lock_held(dequeobject *deque, PyObject *slice)
13341332
static PyObject *
13351333
deque_item_lock_held(dequeobject *deque, Py_ssize_t i)
13361334
{
1337-
// TODO(Matthias): check whether we should support negative indices the usual way?
13381335
Py_ssize_t n = Py_SIZE(deque);
13391336
Py_ssize_t first = deque->first_element;
13401337
Py_ssize_t mask = deque->allocated - 1; // Since allocated is a power of 2
@@ -1391,9 +1388,6 @@ deque_subscript(PyObject *self, PyObject *item)
13911388
return result;
13921389
}
13931390

1394-
// TODO(Matthias): this one is probably broken.
1395-
// TODO(Matthias): optimise from which direction we shift to close the gap.
1396-
// TODO(Matthias): check whether we need to decrease the reference count of the deleted item, or if our callers do that?
13971391
static int
13981392
deque_del_item(dequeobject *deque, Py_ssize_t i)
13991393
{
@@ -1737,13 +1731,8 @@ deque_init_impl(dequeobject *deque, PyObject *iterable, PyObject *maxlenobj)
17371731
deque->maxlen = maxlen;
17381732

17391733
/* Initialize the ring buffer */
1740-
// TODO(Matthias): ok, here's where we set up to start with 8!!!
17411734
deque->allocated = 0; // Start with a power of 2
17421735
deque->ob_item = NULL;
1743-
// if (deque->ob_item == NULL) {
1744-
// PyErr_NoMemory();
1745-
// return -1;
1746-
// }
17471736
deque->first_element = 0;
17481737
Py_SET_SIZE(deque, 0);
17491738

@@ -1986,10 +1975,6 @@ dequeiter_next(PyObject *op)
19861975
Py_BEGIN_CRITICAL_SECTION2(it, it->deque);
19871976
result = dequeiter_next_lock_held(it, it->deque);
19881977
Py_END_CRITICAL_SECTION2();
1989-
// TODO(Matthias): is this needed?
1990-
// if (result == NULL) {
1991-
// Py_DECREF(it);
1992-
// }
19931978
return result;
19941979
}
19951980

@@ -2139,8 +2124,6 @@ dequereviter_next(PyObject *self)
21392124
static PyObject *
21402125
dequereviter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
21412126
{
2142-
// TODO(Matthias): check the implementation carefully.
2143-
// It's just cargo-culted from the deque version, but I don't know exactly what it's trying to do.
21442127
Py_ssize_t i, index = 0;
21452128
PyObject *deque;
21462129
dequeiterobject *it;

0 commit comments

Comments
 (0)