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
c48e4008
Commit
c48e4008
authored
Jan 15, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fit the 'repr' of bucket objects.
Broeken version could contain garbage characters.
parent
7d84f2f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
BTrees/BucketTemplate.c
BTrees/BucketTemplate.c
+2
-2
BTrees/tests/common.py
BTrees/tests/common.py
+12
-0
CHANGES.rst
CHANGES.rst
+2
-1
No files found.
BTrees/BucketTemplate.c
View file @
c48e4008
...
...
@@ -1840,9 +1840,9 @@ bucket_repr(Bucket *self)
{
Py_DECREF
(
r
);
#ifdef PY3K
return
PyUnicode_DecodeLatin1
(
repr
,
s
izeof
(
repr
),
"surrogateescape"
);
return
PyUnicode_DecodeLatin1
(
repr
,
s
trlen
(
repr
),
"surrogateescape"
);
#else
return
PyBytes_FromStringAndSize
(
repr
,
s
izeof
(
repr
));
return
PyBytes_FromStringAndSize
(
repr
,
s
trlen
(
repr
));
#endif
}
else
...
...
BTrees/tests/common.py
View file @
c48e4008
...
...
@@ -202,6 +202,18 @@ class MappingBase(Base):
for
i
in
range
(
l
):
t
[
i
]
=
i
def
testShortRepr
(
self
):
# test the repr because buckets have a complex repr implementation
# internally the cutoff from a stack allocated buffer to a heap
# allocated buffer is 10000.
t
=
self
.
_makeOne
()
for
i
in
range
(
5
):
t
[
i
]
=
i
r
=
repr
(
t
)
# Make sure the repr is **not* 10000 bytes long for a shrort bucket.
# (the buffer must be terminated when copied).
self
.
assertTrue
(
len
(
r
)
<
10000
)
def
testRepr
(
self
):
# test the repr because buckets have a complex repr implementation
# internally the cutoff from a stack allocated buffer to a heap
...
...
CHANGES.rst
View file @
c48e4008
...
...
@@ -5,7 +5,8 @@
4.0.5 (unreleased)
------------------
- TBD
- Fit the ``repr`` of bucket objects, which could contain garbage
characters.
4.0.4 (2013-01-12)
...
...
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