Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
bc697029
Commit
bc697029
authored
Jun 20, 2001
by
matt@zope.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise ZODB.POSException.ConflictError inside of resolveConflict routines
instead of any other error that may be raised.
parent
904f8975
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
9 deletions
+53
-9
src/BTrees/BTreeModuleTemplate.c
src/BTrees/BTreeModuleTemplate.c
+21
-3
src/BTrees/BTreeTemplate.c
src/BTrees/BTreeTemplate.c
+14
-2
src/BTrees/BucketTemplate.c
src/BTrees/BucketTemplate.c
+15
-2
src/BTrees/MergeTemplate.c
src/BTrees/MergeTemplate.c
+3
-2
No files found.
src/BTrees/BTreeModuleTemplate.c
View file @
bc697029
...
...
@@ -115,6 +115,7 @@
static
PyObject
*
sort_str
,
*
reverse_str
,
*
items_str
,
*
__setstate___str
;
static
PyObject
*
ConflictError
=
NULL
;
static
void
PyVar_Assign
(
PyObject
**
v
,
PyObject
*
e
)
{
Py_XDECREF
(
*
v
);
*
v
=
e
;}
#define ASSIGN(V,E) PyVar_Assign(&(V),(E))
...
...
@@ -340,7 +341,7 @@ static char BTree_module_documentation[] =
"
\n
"
MASTER_ID
BTREEITEMSTEMPLATE_C
"$Id: BTreeModuleTemplate.c,v 1.1
1 2001/04/03 15:02:17 jim
Exp $
\n
"
"$Id: BTreeModuleTemplate.c,v 1.1
2 2001/06/20 14:48:51 matt
Exp $
\n
"
BTREETEMPLATE_C
BUCKETTEMPLATE_C
KEYMACROS_H
...
...
@@ -355,7 +356,7 @@ BTREEITEMSTEMPLATE_C
void
INITMODULE
(
void
)
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
,
*
c
;
UNLESS
(
sort_str
=
PyString_FromString
(
"sort"
))
return
;
UNLESS
(
reverse_str
=
PyString_FromString
(
"reverse"
))
return
;
...
...
@@ -385,11 +386,28 @@ INITMODULE (void)
TreeSetType
.
tp_setattro
=
cPersistenceCAPI
->
setattro
;
}
else
return
;
/* Grab the ConflictError class */
m
=
PyImport_ImportModule
(
"ZODB.POSException"
);
if
(
m
!=
NULL
)
{
c
=
PyObject_GetAttrString
(
m
,
"ConflictError"
);
if
(
c
!=
NULL
)
ConflictError
=
c
;
else
ConflictError
=
PyExc_ValueError
;
Py_DECREF
(
m
);
}
else
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
;
...
...
@@ -409,7 +427,7 @@ INITMODULE (void)
d
=
PyModule_GetDict
(
m
);
PyDict_SetItemString
(
d
,
"__version__"
,
PyString_FromString
(
"$Revision: 1.1
1
$"
));
PyString_FromString
(
"$Revision: 1.1
2
$"
));
PyExtensionClass_Export
(
d
,
MOD_NAME_PREFIX
"Bucket"
,
BucketType
);
PyExtensionClass_Export
(
d
,
MOD_NAME_PREFIX
"BTree"
,
BTreeType
);
...
...
src/BTrees/BTreeTemplate.c
View file @
bc697029
...
...
@@ -83,7 +83,7 @@
****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.1
6 2001/04/03 15:02:17 jim
Exp $\n"
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.1
7 2001/06/20 14:48:51 matt
Exp $\n"
/*
** _BTree_get
...
...
@@ -862,7 +862,19 @@ BTree__p_resolveConflict(BTree *self, PyObject *args)
else
r
=
_bucket__p_resolveConflict
(
OBJECT
(
&
SetType
),
s
);
if
(
r
)
ASSIGN
(
r
,
Py_BuildValue
(
"((O))"
,
r
));
if
(
r
)
{
ASSIGN
(
r
,
Py_BuildValue
(
"((O))"
,
r
));
}
else
{
PyObject
*
error
;
PyObject
*
value
;
PyObject
*
traceback
;
/* Change any errors to ConflictErrors */
PyErr_Fetch
(
&
error
,
&
value
,
&
traceback
);
Py_INCREF
(
ConflictError
);
Py_XDECREF
(
error
);
PyErr_Restore
(
ConflictError
,
value
,
traceback
);
}
return
r
;
}
...
...
src/BTrees/BucketTemplate.c
View file @
bc697029
...
...
@@ -82,7 +82,7 @@
****************************************************************************/
#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.1
4 2001/04/03 15:02:17 jim
Exp $\n"
#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.1
5 2001/06/20 14:48:51 matt
Exp $\n"
/*
** _bucket_get
...
...
@@ -1120,10 +1120,23 @@ static PyObject *
bucket__p_resolveConflict
(
Bucket
*
self
,
PyObject
*
args
)
{
PyObject
*
s
[
3
];
PyObject
*
result
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"OOO"
,
&
s
[
0
],
&
s
[
1
],
&
s
[
2
]))
return
NULL
;
return
_bucket__p_resolveConflict
(
OBJECT
(
self
->
ob_type
),
s
);
result
=
_bucket__p_resolveConflict
(
OBJECT
(
self
->
ob_type
),
s
);
/* Change any errors to ConflictErrors */
if
(
result
==
NULL
)
{
PyObject
*
error
;
PyObject
*
value
;
PyObject
*
traceback
;
PyErr_Fetch
(
&
error
,
&
value
,
&
traceback
);
Py_INCREF
(
ConflictError
);
Py_XDECREF
(
error
);
PyErr_Restore
(
ConflictError
,
value
,
traceback
);
}
}
#endif
...
...
src/BTrees/MergeTemplate.c
View file @
bc697029
...
...
@@ -83,7 +83,7 @@
****************************************************************************/
#define MERGETEMPLATE_C "$Id: MergeTemplate.c,v 1.
5 2001/04/03 15:02:17 jim
Exp $\n"
#define MERGETEMPLATE_C "$Id: MergeTemplate.c,v 1.
6 2001/06/20 14:48:51 matt
Exp $\n"
/****************************************************************************
Set operations
...
...
@@ -110,7 +110,8 @@ merge_error(int p1, int p2, int p3, int reason)
PyObject
*
r
;
UNLESS
(
r
=
Py_BuildValue
(
"iiii"
,
p1
,
p2
,
p3
,
reason
))
r
=
Py_None
;
PyErr_SetObject
(
PyExc_ValueError
,
r
);
if
(
ConflictError
==
NULL
)
ConflictError
=
PyExc_ValueError
;
PyErr_SetObject
(
ConflictError
,
r
);
if
(
r
!=
Py_None
)
{
Py_DECREF
(
r
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment