diff --git a/src/persistent/cPersistence.c b/src/persistent/cPersistence.c index 07ab9ad..adb2dd6 100644 --- a/src/persistent/cPersistence.c +++ b/src/persistent/cPersistence.c @@ -28,9 +28,6 @@ struct ccobject_head_struct #include #include -/* These objects are initialized when the module is loaded */ -static PyObject *py_simple_new; - /* Strings initialized by init_strings() below. */ static PyObject *py_keys, *py_setstate, *py___dict__, *py_timeTime; static PyObject *py__p_changed, *py__p_deactivate; @@ -1624,23 +1621,8 @@ Per_setstate(cPersistentObject *self) return 0; } -static PyObject * -simple_new(PyObject *self, PyObject *type_object) -{ - if (!PyType_Check(type_object)) - { - PyErr_SetString(PyExc_TypeError, - "simple_new argument must be a type object."); - return NULL; - } - return PyType_GenericNew((PyTypeObject *)type_object, NULL, NULL); -} - static PyMethodDef cPersistence_methods[] = { - {"simple_new", simple_new, METH_O, - "Create an object by simply calling a class's __new__ method without " - "arguments."}, {NULL, NULL} }; @@ -1713,10 +1695,6 @@ module_init(void) cPersistent_STICKY_STATE) < 0) return NULL; - py_simple_new = PyObject_GetAttrString(module, "simple_new"); - if (!py_simple_new) - return NULL; - copy_reg = PyImport_ImportModule("copyreg"); if (!copy_reg) return NULL; diff --git a/src/persistent/tests/test_persistence.py b/src/persistent/tests/test_persistence.py index c9f844a..6200c44 100644 --- a/src/persistent/tests/test_persistence.py +++ b/src/persistent/tests/test_persistence.py @@ -2204,22 +2204,5 @@ def _makeCache(self, jar): return PickleCache(jar) -@skipIfNoCExtension -class Test_simple_new(unittest.TestCase): - - def _callFUT(self, x): - from persistent._compat import _c_optimizations_available as get_c - simple_new = get_c()['persistent.persistence'].simple_new - return simple_new(x) - - def test_w_non_type(self): - self.assertRaises(TypeError, self._callFUT, '') - - def test_w_type(self): - TO_CREATE = [type, list, tuple, object, dict] - for typ in TO_CREATE: - self.assertIsInstance(self._callFUT(typ), typ) - - def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__)