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
nexedi
ZODB
Commits
54642b0b
Commit
54642b0b
authored
Aug 22, 2009
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added type checks to get better error messages.
parent
709f6b3c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
0 deletions
+25
-0
src/BTrees/BTreeTemplate.c
src/BTrees/BTreeTemplate.c
+6
-0
src/BTrees/BucketTemplate.c
src/BTrees/BucketTemplate.c
+6
-0
src/BTrees/SetTemplate.c
src/BTrees/SetTemplate.c
+6
-0
src/BTrees/tests/testBTrees.py
src/BTrees/tests/testBTrees.py
+7
-0
No files found.
src/BTrees/BTreeTemplate.c
View file @
54642b0b
...
...
@@ -1001,6 +1001,12 @@ _BTree_setstate(BTree *self, PyObject *state, int noval)
if
(
!
PyArg_ParseTuple
(
state
,
"O|O:__setstate__"
,
&
items
,
&
firstbucket
))
return
-
1
;
if
(
!
PyTuple_Check
(
items
))
{
PyErr_SetString
(
PyExc_TypeError
,
"tuple required for first state element"
);
return
-
1
;
}
len
=
PyTuple_Size
(
items
);
if
(
len
<
0
)
return
-
1
;
...
...
src/BTrees/BucketTemplate.c
View file @
54642b0b
...
...
@@ -1182,6 +1182,12 @@ _bucket_setstate(Bucket *self, PyObject *state)
if
(
!
PyArg_ParseTuple
(
state
,
"O|O:__setstate__"
,
&
items
,
&
next
))
return
-
1
;
if
(
!
PyTuple_Check
(
items
))
{
PyErr_SetString
(
PyExc_TypeError
,
"tuple required for first state element"
);
return
-
1
;
}
len
=
PyTuple_Size
(
items
);
if
(
len
<
0
)
return
-
1
;
...
...
src/BTrees/SetTemplate.c
View file @
54642b0b
...
...
@@ -108,6 +108,12 @@ _set_setstate(Bucket *self, PyObject *args)
UNLESS
(
PyArg_ParseTuple
(
args
,
"O|O"
,
&
items
,
&
next
))
return
-
1
;
if
(
!
PyTuple_Check
(
items
))
{
PyErr_SetString
(
PyExc_TypeError
,
"tuple required for first state element"
);
return
-
1
;
}
if
((
l
=
PyTuple_Size
(
items
))
<
0
)
return
-
1
;
for
(
i
=
self
->
len
;
--
i
>=
0
;
)
...
...
src/BTrees/tests/testBTrees.py
View file @
54642b0b
...
...
@@ -83,6 +83,13 @@ class Base(TestCase):
self
.
_closeRoot
(
root
)
self
.
_closeRoot
(
root2
)
def
testSetstateArgumentChecking
(
self
):
try
:
self
.
t
.
__class__
().
__setstate__
((
''
,))
except
TypeError
,
v
:
self
.
assertEqual
(
str
(
v
),
'tuple required for first state element'
)
else
:
raise
AssertionError
(
"Expected exception"
)
def
testGhostUnghost
(
self
):
for
i
in
0
,
10
,
1000
:
t
=
self
.
t
.
__class__
()
...
...
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