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
2c17624b
Commit
2c17624b
authored
Nov 26, 2016
by
David Glick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkpoint
parent
585ec7e5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
3 deletions
+43
-3
BTrees/BTreeTemplate.c
BTrees/BTreeTemplate.c
+4
-0
BTrees/BucketTemplate.c
BTrees/BucketTemplate.c
+5
-1
BTrees/Development.txt
BTrees/Development.txt
+4
-0
BTrees/objectkeymacros.h
BTrees/objectkeymacros.h
+2
-1
BTrees/tests/test_OOBTree.py
BTrees/tests/test_OOBTree.py
+10
-0
CHANGES.rst
CHANGES.rst
+6
-0
tox.ini
tox.ini
+12
-1
No files found.
BTrees/BTreeTemplate.c
View file @
2c17624b
...
...
@@ -726,6 +726,10 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
COPY_KEY_FROM_ARG
(
key
,
keyarg
,
copied
);
if
(
!
copied
)
return
-
1
;
#ifdef KEY_CHECK_ON_SET
if
(
value
&&
!
KEY_CHECK_ON_SET
(
keyarg
))
return
-
1
;
#endif
PER_USE_OR_RETURN
(
self
,
-
1
);
...
...
BTrees/BucketTemplate.c
View file @
2c17624b
...
...
@@ -323,6 +323,10 @@ _bucket_set(Bucket *self, PyObject *keyarg, PyObject *v,
COPY_KEY_FROM_ARG
(
key
,
keyarg
,
copied
);
UNLESS
(
copied
)
return
-
1
;
#ifdef KEY_CHECK_ON_SET
if
(
v
&&
!
KEY_CHECK_ON_SET
(
keyarg
))
return
-
1
;
#endif
/* Copy the value early (if needed), so that in case of error a
* pile of bucket mutations don't need to be undone.
...
...
@@ -451,7 +455,7 @@ Done:
/*
** bucket_setitem
**
** wrapper for _bucket_set
item
(eliminates +1 return code)
** wrapper for _bucket_set (eliminates +1 return code)
**
** Arguments: self The bucket
** key The key to insert under
...
...
BTrees/Development.txt
View file @
2c17624b
...
...
@@ -58,6 +58,10 @@ Macros for Keys
non-zero for true). When it returns false, its caller should probably set
a ``TypeError`` exception.
``KEY_CHECK_ON_SET(K)``
Like ``KEY_CHECK``, but only checked during ``__setitem__``.
``TEST_KEY_SET_OR(V, K, T)``
Like Python's ``cmp()``. Compares K(ey) to T(arget), where ``K``
...
...
BTrees/objectkeymacros.h
View file @
2c17624b
...
...
@@ -37,4 +37,5 @@ if ( ( (V) = COMPARE((KEY),(TARGET)) ), PyErr_Occurred() )
#define COPY_KEY_TO_OBJECT(O, K) O=(K); Py_INCREF(O)
#define COPY_KEY_FROM_ARG(TARGET, ARG, S) \
TARGET=(ARG); \
(S) = check_argument_cmp(ARG);
(S) = 1;
#define KEY_CHECK_ON_SET check_argument_cmp
BTrees/tests/test_OOBTree.py
View file @
2c17624b
...
...
@@ -160,6 +160,16 @@ class OOBTreeTest(BTreeTests, unittest.TestCase):
self
.
assertRaises
(
KeyError
,
t
.
__getitem__
,
C
())
self
.
assertFalse
(
C
()
in
t
)
def
testDeleteExistingKeyWithDefaultComparison
(
self
):
t
=
self
.
_makeOne
()
bucket_state
=
((
None
,
42
),)
tree_state
=
((
bucket_state
,),)
t
.
__setstate__
(
tree_state
)
self
.
assertEqual
(
t
[
None
],
42
)
del
t
[
None
]
class
OOBTreePyTest
(
OOBTreeTest
):
#
# Right now, we can't match the C extension's test / prohibition of the
...
...
CHANGES.rst
View file @
2c17624b
...
...
@@ -4,6 +4,12 @@
4.3.2 (unreleased)
------------------
- Make the CPython implementation consistent with the pure-Python
implementation and only check object keys for default comparison
when setting keys. This makes it possible to remove keys that
were added using a less restrictive version of BTrees. See:
https://github.com/zopefoundation/BTrees/issues/53
- Make the CPython implementation consistent with the pure-Python
implementation and no longer raise ``TypeError`` for an object key
(in object-keyed trees) with default comparison on ``__getitem__``,
...
...
tox.ini
View file @
2c17624b
...
...
@@ -3,7 +3,7 @@ envlist =
# Jython support pending 2.7 support, due 2012-07-15 or so. See:
# http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
# py27,jython,pypy,coverage,docs
py27,py27-pure,pypy,py33,py34,py35,pypy3,w_zodb,coverage,docs
py27,py27-pure,pypy,py33,py34,py35,py
35-pure,py
py3,w_zodb,coverage,docs
[testenv]
deps
=
...
...
@@ -24,6 +24,17 @@ deps =
commands
=
python
setup.py
-q
test
-q
[testenv:py35-pure]
basepython
=
python3.5
setenv
=
PURE_PYTHON
=
1
PIP_CACHE_DIR
=
{envdir}/.cache
deps
=
{
[testenv]
deps}
commands
=
python
setup.py
-q
test
-q
#[testenv:jython]
#commands =
# jython setup.py test -q
...
...
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