Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BTrees
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
BTrees
Commits
141c28af
Commit
141c28af
authored
Apr 07, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix setting _p_changed for small pure-Python BTrees.
parent
b49be3c9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
6 deletions
+43
-6
.gitignore
.gitignore
+1
-0
BTrees/_base.py
BTrees/_base.py
+10
-5
BTrees/tests/common.py
BTrees/tests/common.py
+29
-1
CHANGES.rst
CHANGES.rst
+3
-0
No files found.
.gitignore
View file @
141c28af
...
...
@@ -16,3 +16,4 @@ coverage.xml
*.egg
dist
.eggs/
.dir-locals.el
BTrees/_base.py
View file @
141c28af
...
...
@@ -883,11 +883,16 @@ class _Tree(_Base):
max_size
=
self
.
max_leaf_size
if
child
.
size
>
max_size
:
self
.
_grow
(
child
,
index
)
elif
(
grew
is
not
None
and
# If a BTree contains only a single bucket, BTree.__getstate__()
# includes the bucket's entire state, and the bucket doesn't get
# an oid of its own. So if we have a single oid-less bucket that
# changed, it's *our* oid that should be marked as changed -- the
# bucket doesn't have one.
if
(
grew
is
not
None
and
child
.
__class__
is
self
.
_bucket_type
and
len
(
data
)
==
1
and
child
.
_p_oid
is
None
):
child
.
_p_oid
is
None
):
self
.
_p_changed
=
1
return
result
...
...
BTrees/tests/common.py
View file @
141c28af
...
...
@@ -768,7 +768,6 @@ class MappingBase(Base):
# Too many arguments.
self
.
assertRaises
(
TypeError
,
t
.
pop
,
1
,
2
,
3
)
class
BTreeTests
(
MappingBase
):
# Tests common to all BTrees
...
...
@@ -1091,6 +1090,35 @@ class BTreeTests(MappingBase):
self
.
assertEqual
(
str
(
v
),
str
(
k
[
0
]))
self
.
_checkIt
(
t
)
def
testAddTwoSetsChanged
(
self
):
# A bug in the BTree Python implementation once
# caused adding a second item to a tree to fail
# to set _p_changed (adding the first item sets it because
# the _firstbucket gets set, but the second item only grew the
# existing bucket)
t
=
self
.
_makeOne
()
# Note that for the property to actually hold, we have to fake a
# _p_jar and _p_oid
t
.
_p_oid
=
b'
\
0
\
0
\
0
\
0
\
0
'
class
Jar
(
object
):
def
__init__
(
self
):
self
.
_cache
=
self
self
.
registered
=
None
def
mru
(
self
,
arg
):
pass
def
readCurrent
(
self
,
arg
):
pass
def
register
(
self
,
arg
):
self
.
registered
=
arg
t
.
_p_jar
=
Jar
()
t
[
1
]
=
3
t
.
_p_changed
=
False
t
.
_p_jar
.
registered
=
None
t
[
2
]
=
4
self
.
assertTrue
(
t
.
_p_changed
)
self
.
assertEqual
(
t
,
t
.
_p_jar
.
registered
)
class
NormalSetTests
(
Base
):
# Test common to all set types
...
...
CHANGES.rst
View file @
141c28af
...
...
@@ -7,6 +7,9 @@
- Suppress testing 64-bit values in OLBTrees on 32 bit machines.
See: https://github.com/zopefoundation/BTrees/issues/9
- Fix _p_changed for small pure-Python BTrees.
See https://github.com/zopefoundation/BTrees/issues/10
4.1.1 (2014-12-27)
------------------
...
...
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