[Python-checkins] r46383 - python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
georg.brandl
python-checkins at python.org
Fri May 26 20:31:49 CEST 2006
Author: georg.brandl
Date: Fri May 26 20:31:48 2006
New Revision: 46383
Modified:
python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
Log:
Making StopIteration a singleton didn't give a notable speedup.
Modified: python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
==============================================================================
--- python/branches/sreifschneider-newnewexcept/Objects/exceptions.c (original)
+++ python/branches/sreifschneider-newnewexcept/Objects/exceptions.c Fri May 26 20:31:48 2006
@@ -16,22 +16,11 @@
PyObject *message;
} BaseExceptionObject;
-static PyTypeObject _PyExc_StopIteration;
-PyObject *PyExc_StopIterationInst;
-
static PyObject *
BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
BaseExceptionObject *self;
- /* Make StopIteration be a singleton as often as we can */
- if ((args == NULL || PyTuple_GET_SIZE(args) == 0) &&
- PyExc_StopIterationInst != NULL &&
- type == &_PyExc_StopIteration) {
- Py_INCREF(PyExc_StopIterationInst);
- return PyExc_StopIterationInst;
- }
-
self = (BaseExceptionObject *)type->tp_alloc(type, 0);
self->args = self->message = self->dict = NULL;
@@ -1969,9 +1958,6 @@
*/
PyObject *PyExc_MemoryErrorInst=NULL;
-/* Make StopIteration be a singleton as often as we can */
-PyObject *PyExc_StopIterationInst=NULL;
-
/* module global functions */
static PyMethodDef functions[] = {
/* Sentinel */
@@ -2113,11 +2099,6 @@
if (!PyExc_MemoryErrorInst)
Py_FatalError("Cannot pre-allocate MemoryError instance\n");
- PyExc_StopIterationInst = BaseException_new(&_PyExc_StopIteration, NULL,
- NULL);
- if (!PyExc_StopIterationInst)
- Py_FatalError("Cannot pre-allocate StopIteration instance\n");
-
Py_DECREF(bdict);
Py_DECREF(bltinmod);
}
More information about the Python-checkins
mailing list