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
be19c1f3
Commit
be19c1f3
authored
May 19, 2014
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: integer overflow on 32-bit machines wasn't detected correctly
under Python 3.
parent
4c6f43b6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
6 deletions
+19
-6
BTrees/intkeymacros.h
BTrees/intkeymacros.h
+4
-3
BTrees/intvaluemacros.h
BTrees/intvaluemacros.h
+2
-1
BTrees/tests/testBTrees.py
BTrees/tests/testBTrees.py
+9
-2
BTrees/tests/test_IIBTree.py
BTrees/tests/test_IIBTree.py
+2
-0
CHANGES.rst
CHANGES.rst
+2
-0
No files found.
BTrees/intkeymacros.h
View file @
be19c1f3
...
@@ -21,7 +21,8 @@
...
@@ -21,7 +21,8 @@
#define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \
#define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \
if (INT_CHECK(ARG)) { \
if (INT_CHECK(ARG)) { \
long vcopy = INT_AS_LONG(ARG); \
long vcopy = INT_AS_LONG(ARG); \
if ((int)vcopy != vcopy) { \
if (PyErr_Occurred()) { (STATUS)=0; (TARGET)=0; } \
else if ((int)vcopy != vcopy) { \
PyErr_SetString(PyExc_TypeError, "integer out of range"); \
PyErr_SetString(PyExc_TypeError, "integer out of range"); \
(STATUS)=0; (TARGET)=0; \
(STATUS)=0; (TARGET)=0; \
} \
} \
...
...
BTrees/intvaluemacros.h
View file @
be19c1f3
...
@@ -23,7 +23,8 @@
...
@@ -23,7 +23,8 @@
#define COPY_VALUE_FROM_ARG(TARGET, ARG, STATUS) \
#define COPY_VALUE_FROM_ARG(TARGET, ARG, STATUS) \
if (INT_CHECK(ARG)) { \
if (INT_CHECK(ARG)) { \
long vcopy = INT_AS_LONG(ARG); \
long vcopy = INT_AS_LONG(ARG); \
if ((int)vcopy != vcopy) { \
if (PyErr_Occurred()) { (STATUS)=0; (TARGET)=0; } \
else if ((int)vcopy != vcopy) { \
PyErr_SetString(PyExc_TypeError, "integer out of range"); \
PyErr_SetString(PyExc_TypeError, "integer out of range"); \
(STATUS)=0; (TARGET)=0; \
(STATUS)=0; (TARGET)=0; \
} \
} \
...
...
BTrees/tests/testBTrees.py
View file @
be19c1f3
...
@@ -11,8 +11,11 @@
...
@@ -11,8 +11,11 @@
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
#
#
##############################################################################
##############################################################################
import
sys
import
unittest
import
unittest
python3
=
sys
.
version_info
>=
(
3
,
)
from
BTrees.tests.common
import
permutations
from
BTrees.tests.common
import
permutations
...
@@ -451,8 +454,12 @@ class FamilyTest(unittest.TestCase):
...
@@ -451,8 +454,12 @@ class FamilyTest(unittest.TestCase):
# the characteristics change to match the 64 bit version, please
# the characteristics change to match the 64 bit version, please
# feel free to change.
# feel free to change.
big
=
BTrees
.
family32
.
maxint
+
1
big
=
BTrees
.
family32
.
maxint
+
1
self
.
assertRaises
(
TypeError
,
s
.
insert
,
big
)
if
python3
:
self
.
assertRaises
(
TypeError
,
s
.
insert
,
BTrees
.
family32
.
minint
-
1
)
expected_exception
=
OverflowError
else
:
expected_exception
=
TypeError
self
.
assertRaises
(
expected_exception
,
s
.
insert
,
BTrees
.
family32
.
minint
-
1
)
self
.
check_pickling
(
BTrees
.
family32
)
self
.
check_pickling
(
BTrees
.
family32
)
def
test64
(
self
):
def
test64
(
self
):
...
...
BTrees/tests/test_IIBTree.py
View file @
be19c1f3
...
@@ -113,6 +113,8 @@ class _IIBTreeTestBase(BTreeTests):
...
@@ -113,6 +113,8 @@ class _IIBTreeTestBase(BTreeTests):
i
=
int
(
i
)
i
=
int
(
i
)
try
:
try
:
b
[
i
]
=
0
b
[
i
]
=
0
except
OverflowError
:
self
.
assertRaises
(
OverflowError
,
b
.
__setitem__
,
0
,
i
)
except
TypeError
:
except
TypeError
:
self
.
assertRaises
(
TypeError
,
b
.
__setitem__
,
0
,
i
)
self
.
assertRaises
(
TypeError
,
b
.
__setitem__
,
0
,
i
)
else
:
else
:
...
...
CHANGES.rst
View file @
be19c1f3
``BTrees`` Changelog
``BTrees`` Changelog
====================
====================
- Fixed: integer overflow on 32-bit machines wasn't detected correctly
under Python 3.
4.0.9 (unreleased)
4.0.9 (unreleased)
------------------
------------------
...
...
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