[Zope-Checkins] CVS: Products/DCOracle2/src - dco2.c:1.131

Matthew T. Kromer matt@zope.com
Fri, 14 Mar 2003 10:08:12 -0500


Update of /cvs-repository/Products/DCOracle2/src
In directory cvs.zope.org:/tmp/cvs-serv13077/src

Modified Files:
	dco2.c 
Log Message:
Convert error code 1013 (User requested interrupt) to a KeyboardInterrupt
exception rather than a DatabaseError.


=== Products/DCOracle2/src/dco2.c 1.130 => 1.131 ===
--- Products/DCOracle2/src/dco2.c:1.130	Thu Feb 13 19:01:20 2003
+++ Products/DCOracle2/src/dco2.c	Fri Mar 14 10:08:11 2003
@@ -1476,12 +1476,17 @@
 static PyObject *RaiseOCIError1(dvoid *hp, ub4 handle_type, int setpy) {
 	text buff[OCI_ERROR_MAXMSG_SIZE];
 	sb4	errcode;
+	PyObject *eo;
+
+	eo = ErrorObject;
 
 	OCIErrorGet(hp, 1, NULL, &errcode, buff, sizeof(buff), handle_type);
 
-	if (setpy == 1) 
-	PyErr_SetObject(ErrorObject, Py_BuildValue("is#", (int) errcode, buff,
-		strlen(buff)-1));
+	if (errcode == 1013) eo = PyExc_KeyboardInterrupt;
+
+	if (setpy == 1)
+		PyErr_SetObject(eo, Py_BuildValue("is#", (int) errcode, buff,
+			strlen(buff)-1));
 #ifndef DCO2ERRPRINT
 	else
 #endif
@@ -7098,6 +7103,10 @@
 		}
 		ba->objectp[i] = value;
 		Py_INCREF(value);
+	} else {
+		/* Toss out any saved old value object */
+		Py_XDECREF(ba->objectp[i]);
+		ba->objectp[i] = NULL;
 	}