[Zope-Checkins] CVS: Zope2 - BTreeModuleTemplate.c:1.13 BucketTemplate.c:1.16 MergeTemplate.c:1.7
Matthew T. Kromer
matt@digicool.com
Wed, 20 Jun 2001 15:32:56 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/BTrees
In directory korak.digicool.com:/tmp/cvs-serv21756
Modified Files:
BTreeModuleTemplate.c BucketTemplate.c MergeTemplate.c
Log Message:
Fix result return from ConflictError trap
--- Updated File BTreeModuleTemplate.c in package Zope2 --
--- BTreeModuleTemplate.c 2001/06/20 14:48:51 1.12
+++ BTreeModuleTemplate.c 2001/06/20 19:32:55 1.13
@@ -395,19 +395,19 @@
c = PyObject_GetAttrString(m,"ConflictError");
if (c != NULL)
ConflictError = c;
- else
- ConflictError = PyExc_ValueError;
Py_DECREF(m);
- } else ConflictError = PyExc_ValueError;
+ }
+ if (ConflictError == NULL) {
+ Py_INCREF(PyExc_ValueError);
+ ConflictError=PyExc_ValueError;
+ }
#else
BTreeType.tp_getattro=PyExtensionClassCAPI->getattro;
BucketType.tp_getattro=PyExtensionClassCAPI->getattro;
SetType.tp_getattro=PyExtensionClassCAPI->getattro;
TreeSetType.tp_getattro=PyExtensionClassCAPI->getattro;
-
- ConflictError = PyExc_ValueError; /* MergeTemplate checks anyway */
#endif
BTreeItemsType.ob_type=&PyType_Type;
--- Updated File BucketTemplate.c in package Zope2 --
--- BucketTemplate.c 2001/06/20 14:48:51 1.15
+++ BucketTemplate.c 2001/06/20 19:32:55 1.16
@@ -1137,6 +1137,8 @@
Py_XDECREF(error);
PyErr_Restore(ConflictError, value, traceback);
}
+
+ return result;
}
#endif
--- Updated File MergeTemplate.c in package Zope2 --
--- MergeTemplate.c 2001/06/20 14:48:51 1.6
+++ MergeTemplate.c 2001/06/20 19:32:55 1.7
@@ -110,7 +110,10 @@
PyObject *r;
UNLESS (r=Py_BuildValue("iiii", p1, p2, p3, reason)) r=Py_None;
- if (ConflictError == NULL) ConflictError=PyExc_ValueError;
+ if (ConflictError == NULL) {
+ ConflictError=PyExc_ValueError;
+ Py_INCREF(ConflictError);
+ }
PyErr_SetObject(ConflictError, r);
if (r != Py_None)
{