Skip to content

Commit

Permalink
ordereddict: remove C implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Apr 23, 2023
1 parent da071fa commit f7b87a0
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 2,388 deletions.
1 change: 0 additions & 1 deletion Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
#include "tupleobject.h"
#include "listobject.h"
#include "dictobject.h"
#include "cpython/odictobject.h"
#include "enumobject.h"
#include "setobject.h"
#include "methodobject.h"
Expand Down
43 changes: 0 additions & 43 deletions Include/cpython/odictobject.h

This file was deleted.

7 changes: 0 additions & 7 deletions Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,6 @@ def __ror__(self, other):
return new


try:
from _collections import OrderedDict
except ImportError:
# Leave the pure Python version in place.
pass


################################################################################
### namedtuple
################################################################################
Expand Down
33 changes: 0 additions & 33 deletions Lib/test/test_ordered_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,39 +767,6 @@ class CPythonOrderedDictTests(OrderedDictTests, unittest.TestCase):
OrderedDict = c_coll.OrderedDict
check_sizeof = support.check_sizeof

@support.cpython_only
def test_sizeof_exact(self):
OrderedDict = self.OrderedDict
calcsize = struct.calcsize
size = support.calcobjsize
check = self.check_sizeof

basicsize = size('nQ2P' + '3PnPn2P')
keysize = calcsize('n2BI2n')

entrysize = calcsize('n2P')
p = calcsize('P')
nodesize = calcsize('Pn2P')

od = OrderedDict()
check(od, basicsize) # 8byte indices + 8*2//3 * entry table
od.x = 1
check(od, basicsize)
od.update([(i, i) for i in range(3)])
check(od, basicsize + keysize + 8*p + 8 + 5*entrysize + 3*nodesize)
od.update([(i, i) for i in range(3, 10)])
check(od, basicsize + keysize + 16*p + 16 + 10*entrysize + 10*nodesize)

check(od.keys(), size('P'))
check(od.items(), size('P'))
check(od.values(), size('P'))

itersize = size('iP2n2P')
check(iter(od), itersize)
check(iter(od.keys()), itersize)
check(iter(od.items()), itersize)
check(iter(od.values()), itersize)

def test_key_change_during_iteration(self):
OrderedDict = self.OrderedDict

Expand Down
2 changes: 0 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ OBJECT_OBJS= \
Objects/listobject.o \
Objects/longobject.o \
Objects/dictobject.o \
Objects/odictobject.o \
Objects/memoryobject.o \
Objects/methodobject.o \
Objects/moduleobject.o \
Expand Down Expand Up @@ -1624,7 +1623,6 @@ PYTHON_HEADERS= \
$(srcdir)/Include/cpython/modsupport.h \
$(srcdir)/Include/cpython/object.h \
$(srcdir)/Include/cpython/objimpl.h \
$(srcdir)/Include/cpython/odictobject.h \
$(srcdir)/Include/cpython/picklebufobject.h \
$(srcdir)/Include/cpython/pthread_stubs.h \
$(srcdir)/Include/cpython/pyctype.h \
Expand Down
1 change: 0 additions & 1 deletion Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,6 @@ collections_exec(PyObject *module) {
PyTypeObject *typelist[] = {
&deque_type,
&defdict_type,
&PyODict_Type,
&dequeiter_type,
&dequereviter_type,
&tuplegetter_type
Expand Down
4 changes: 0 additions & 4 deletions Modules/_testcapimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,6 @@ test_get_type_qualname(PyObject *self, PyObject *Py_UNUSED(ignored))
assert(strcmp(PyUnicode_AsUTF8(tp_qualname), "int") == 0);
Py_DECREF(tp_qualname);

tp_qualname = PyType_GetQualName(&PyODict_Type);
assert(strcmp(PyUnicode_AsUTF8(tp_qualname), "OrderedDict") == 0);
Py_DECREF(tp_qualname);

PyObject *HeapTypeNameType = PyType_FromSpec(&HeapTypeNameType_Spec);
if (HeapTypeNameType == NULL) {
Py_RETURN_NONE;
Expand Down
5 changes: 0 additions & 5 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,6 @@ static PyTypeObject* static_types[] = {
&PyMethod_Type,
&PyModuleDef_Type,
&PyModule_Type,
&PyODictIter_Type,
&PyPickleBuffer_Type,
&PyProperty_Type,
&PyRangeIter_Type,
Expand Down Expand Up @@ -2018,10 +2017,6 @@ static PyTypeObject* static_types[] = {
// class
&PyBool_Type, // base=&PyLong_Type
&PyCMethod_Type, // base=&PyCFunction_Type
&PyODictItems_Type, // base=&PyDictItems_Type
&PyODictKeys_Type, // base=&PyDictKeys_Type
&PyODictValues_Type, // base=&PyDictValues_Type
&PyODict_Type, // base=&PyDict_Type
};


Expand Down
Loading

0 comments on commit f7b87a0

Please sign in to comment.