[Zope-Checkins] CVS: Zope2 - BucketTemplate.c:1.6.2.11
Jim Fulton
jim@digiciool.com
Wed, 14 Mar 2001 21:00:00 -0500 (EST)
Update of /cvs-repository/Zope2/lib/python/BTrees
In directory korak:/tmp/cvs-serv10821
Modified Files:
Tag: Catalog-BTrees-Integration
BucketTemplate.c
Log Message:
Fixed conflict-resolution bug: I forgot to include the next bucket in
the output state.
--- Updated File BucketTemplate.c in package Zope2 --
--- BucketTemplate.c 2001/03/14 14:54:13 1.6.2.10
+++ BucketTemplate.c 2001/03/15 02:00:00 1.6.2.11
@@ -1032,12 +1032,12 @@
#ifdef PERSISTENT
static PyObject *merge_error(int p1, int p2, int p3, int reason);
-static PyObject *bucket_merge(PyObject *s1, PyObject *s2, PyObject *s3);
+static PyObject *bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3);
static PyObject *
_bucket__p_resolveConflict(PyObject *ob_type, PyObject *s[3])
{
- PyObject *r=0;
+ PyObject *r=0, *a;
Bucket *b[3];
int i;
@@ -1048,8 +1048,17 @@
if (s[i] == Py_None) /* None is equivalent to empty, for BTrees */
continue;
ASSIGN(r, PyObject_GetAttr(OBJECT(b[i]), __setstate___str));
- if (r) ASSIGN(r, PyObject_CallFunction(r, "(O)", s[i]));
- if (r) continue;
+ if (a=PyTuple_New(1))
+ {
+ if (r)
+ {
+ PyTuple_SET_ITEM(a, 0, s[i]);
+ Py_INCREF(s[i]);
+ ASSIGN(r, PyObject_CallObject(r, a));
+ }
+ Py_DECREF(a);
+ if (r) continue;
+ }
}
Py_XDECREF(r);
while (--i >= 0)
@@ -1067,7 +1076,7 @@
goto err;
}
- r=bucket_merge(OBJECT(b[0]), OBJECT(b[1]), OBJECT(b[2]));
+ r=bucket_merge(b[0], b[1], b[2]);
err:
Py_DECREF(b[0]);