[Zope-Checkins] CVS: Products/DCOracle2/src - dco2.c:1.110
Matthew T. Kromer
matt@zope.com
Wed, 15 May 2002 17:11:11 -0400
Update of /cvs-repository/Products/DCOracle2/src
In directory cvs.zope.org:/tmp/cvs-serv27183/src
Modified Files:
dco2.c
Log Message:
Fix error classes so that DatabaseError and ProgrammingError (the only
two errors raised by DCOracle2) don't have their IDs change if the
module is reloaded.
=== Products/DCOracle2/src/dco2.c 1.109 => 1.110 ===
} DescriptorEntry;
-static PyObject *ErrorObject;
-static PyObject *ProgrammingErrorObject;
+static PyObject *ErrorObject = NULL;
+static PyObject *ProgrammingErrorObject = NULL;
#ifdef COMMONENVIRONMENT
static OCIEnv *GLBenvhp;
@@ -6882,8 +6882,9 @@
Py_DECREF(eo);
- ErrorObject = PyErr_NewException("dco2.Error", PyExc_StandardError,
- NULL);
+ if (ErrorObject == NULL)
+ ErrorObject = PyErr_NewException("dco2.Error",
+ PyExc_StandardError, NULL);
PyDict_SetItemString(dict, "Error", ErrorObject);
@@ -6910,10 +6911,11 @@
PyDict_SetItemString(dict, "OperationalError", eo);
Py_DECREF(eo);
- eo = PyErr_NewException("dco2.ProgrammingError", ErrorObject,
- NULL);
- PyDict_SetItemString(dict, "ProgrammingError", eo);
- ProgrammingErrorObject = eo;
+ if (ProgrammingErrorObject == NULL)
+ ProgrammingErrorObject =
+ PyErr_NewException("dco2.ProgrammingError",
+ ErrorObject, NULL);
+ PyDict_SetItemString(dict, "ProgrammingError", ProgrammingErrorObject);
eo = PyErr_NewException("dco2.IntegrityError", ErrorObject,
NULL);