Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
07aec08a
Commit
07aec08a
authored
Aug 24, 2007
by
Gregory P. Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reapply of r57378 to fix bug 1725856
parent
fc5fafcf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
Lib/bsddb/__init__.py
Lib/bsddb/__init__.py
+4
-0
Lib/test/test_bsddb.py
Lib/test/test_bsddb.py
+16
-0
No files found.
Lib/bsddb/__init__.py
View file @
07aec08a
...
...
@@ -266,12 +266,16 @@ class _DBWithCursor(_iter_mixin):
def
first
(
self
):
self
.
_checkOpen
()
# fix 1725856: don't needlessly try to restore our cursor position
self
.
saved_dbc_key
=
None
self
.
_checkCursor
()
rv
=
_DeadlockWrap
(
self
.
dbc
.
first
)
return
rv
def
last
(
self
):
self
.
_checkOpen
()
# fix 1725856: don't needlessly try to restore our cursor position
self
.
saved_dbc_key
=
None
self
.
_checkCursor
()
rv
=
_DeadlockWrap
(
self
.
dbc
.
last
)
return
rv
...
...
Lib/test/test_bsddb.py
View file @
07aec08a
...
...
@@ -131,6 +131,22 @@ class TestBSDDB(unittest.TestCase):
items
.
append
(
self
.
f
.
previous
())
self
.
assertSetEquals
(
items
,
self
.
d
.
items
())
def
test_first_while_deleting
(
self
):
# Test for bug 1725856
self
.
assert_
(
len
(
self
.
d
)
>=
2
,
"test requires >=2 items"
)
for
_
in
self
.
d
:
key
=
self
.
f
.
first
()[
0
]
del
self
.
f
[
key
]
self
.
assertEqual
(
0
,
len
(
self
.
f
),
"expected empty db after test"
)
def
test_last_while_deleting
(
self
):
# Test for bug 1725856's evil twin
self
.
assert_
(
len
(
self
.
d
)
>=
2
,
"test requires >=2 items"
)
for
_
in
self
.
d
:
key
=
self
.
f
.
last
()[
0
]
del
self
.
f
[
key
]
self
.
assertEqual
(
0
,
len
(
self
.
f
),
"expected empty db after test"
)
def
test_set_location
(
self
):
self
.
assertEqual
(
self
.
f
.
set_location
(
'e'
),
(
'e'
,
self
.
d
[
'e'
]))
...
...
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