Skip to content

Commit 827d49f

Browse files
bpo-33031: Remove dead code in C implementation of OrderedDict. (GH-6120)
This code doesn't have effect on the final result, but causes GCC 8 warnings and can have an undefined behavior.
1 parent e4679cd commit 827d49f

File tree

1 file changed

+1
-76
lines changed

1 file changed

+1
-76
lines changed

Objects/odictobject.c

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -859,64 +859,6 @@ static PyMappingMethods odict_as_mapping = {
859859
* OrderedDict methods
860860
*/
861861

862-
/* __delitem__() */
863-
864-
PyDoc_STRVAR(odict_delitem__doc__, "od.__delitem__(y) <==> del od[y]");
865-
866-
/* __eq__() */
867-
868-
PyDoc_STRVAR(odict_eq__doc__,
869-
"od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive\n\
870-
while comparison to a regular mapping is order-insensitive.\n\
871-
");
872-
873-
/* forward */
874-
static PyObject * odict_richcompare(PyObject *v, PyObject *w, int op);
875-
876-
static PyObject *
877-
odict_eq(PyObject *a, PyObject *b)
878-
{
879-
return odict_richcompare(a, b, Py_EQ);
880-
}
881-
882-
/* __init__() */
883-
884-
PyDoc_STRVAR(odict_init__doc__,
885-
"Initialize an ordered dictionary. The signature is the same as\n\
886-
regular dictionaries. Keyword argument order is preserved.\n\
887-
\n\
888-
");
889-
890-
/* forward */
891-
static int odict_init(PyObject *self, PyObject *args, PyObject *kwds);
892-
893-
/* __iter__() */
894-
895-
PyDoc_STRVAR(odict_iter__doc__, "od.__iter__() <==> iter(od)");
896-
897-
static PyObject * odict_iter(PyODictObject *self); /* forward */
898-
899-
/* __ne__() */
900-
901-
/* Mapping.__ne__() does not have a docstring. */
902-
PyDoc_STRVAR(odict_ne__doc__, "");
903-
904-
static PyObject *
905-
odict_ne(PyObject *a, PyObject *b)
906-
{
907-
return odict_richcompare(a, b, Py_NE);
908-
}
909-
910-
/* __repr__() */
911-
912-
PyDoc_STRVAR(odict_repr__doc__, "od.__repr__() <==> repr(od)");
913-
914-
static PyObject * odict_repr(PyODictObject *self); /* forward */
915-
916-
/* __setitem__() */
917-
918-
PyDoc_STRVAR(odict_setitem__doc__, "od.__setitem__(i, y) <==> od[i]=y");
919-
920862
/* fromkeys() */
921863

922864
/*[clinic input]
@@ -1370,25 +1312,8 @@ OrderedDict_move_to_end_impl(PyODictObject *self, PyObject *key, int last)
13701312

13711313
static PyMethodDef odict_methods[] = {
13721314

1373-
/* explicitly defined so we can align docstrings with
1374-
* collections.OrderedDict */
1375-
{"__delitem__", (PyCFunction)odict_mp_ass_sub, METH_NOARGS,
1376-
odict_delitem__doc__},
1377-
{"__eq__", (PyCFunction)odict_eq, METH_NOARGS,
1378-
odict_eq__doc__},
1379-
{"__init__", (PyCFunction)odict_init, METH_NOARGS,
1380-
odict_init__doc__},
1381-
{"__iter__", (PyCFunction)odict_iter, METH_NOARGS,
1382-
odict_iter__doc__},
1383-
{"__ne__", (PyCFunction)odict_ne, METH_NOARGS,
1384-
odict_ne__doc__},
1385-
{"__repr__", (PyCFunction)odict_repr, METH_NOARGS,
1386-
odict_repr__doc__},
1387-
{"__setitem__", (PyCFunction)odict_mp_ass_sub, METH_NOARGS,
1388-
odict_setitem__doc__},
1389-
ORDEREDDICT_FROMKEYS_METHODDEF
1390-
13911315
/* overridden dict methods */
1316+
ORDEREDDICT_FROMKEYS_METHODDEF
13921317
{"__sizeof__", (PyCFunction)odict_sizeof, METH_NOARGS,
13931318
odict_sizeof__doc__},
13941319
{"__reduce__", (PyCFunction)odict_reduce, METH_NOARGS,

0 commit comments

Comments
 (0)