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
ca8d3909
Commit
ca8d3909
authored
Mar 09, 2018
by
Jason Madden
Committed by
GitHub
Mar 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #83 from zopefoundation/issue79
Use operator.index to avoid DeprecationWarning on Python 2
parents
023d96a7
4debe1bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
15 deletions
+9
-15
BTrees/_base.py
BTrees/_base.py
+5
-14
CHANGES.rst
CHANGES.rst
+4
-1
No files found.
BTrees/_base.py
View file @
ca8d3909
...
...
@@ -16,6 +16,7 @@
from
struct
import
Struct
from
struct
import
error
as
struct_error
from
operator
import
index
from
persistent
import
Persistent
...
...
@@ -1503,12 +1504,8 @@ int_pack, int_unpack = _packer_unpacker('i')
def
to_int
(
self
,
v
):
try
:
# XXX Python 2.6 doesn't truncate, it spews a warning.
if
not
int_unpack
(
int_pack
(
v
))[
0
]
==
v
:
#pragma: no cover
raise
TypeError
(
'32-bit integer expected'
)
except
(
struct_error
,
OverflowError
,
#PyPy
):
int_pack
(
index
(
v
))
except
(
struct_error
,
TypeError
):
raise
TypeError
(
'32-bit integer expected'
)
return
int
(
v
)
...
...
@@ -1527,14 +1524,8 @@ long_pack, long_unpack = _packer_unpacker('q')
def
to_long
(
self
,
v
):
try
:
# XXX Python 2.6 doesn't truncate, it spews a warning.
if
not
long_unpack
(
long_pack
(
v
))[
0
]
==
v
:
#pragma: no cover
if
isinstance
(
v
,
int_types
):
raise
ValueError
(
"Value out of range"
,
v
)
raise
TypeError
(
'64-bit integer expected'
)
except
(
struct_error
,
OverflowError
,
#PyPy
):
long_pack
(
index
(
v
))
except
(
struct_error
,
TypeError
):
if
isinstance
(
v
,
int_types
):
raise
ValueError
(
"Value out of range"
,
v
)
raise
TypeError
(
'64-bit integer expected'
)
...
...
CHANGES.rst
View file @
ca8d3909
...
...
@@ -14,7 +14,10 @@
- Respect the ``PURE_PYTHON`` environment variable at runtime even if
the C extensions are available. See
https://github.com/zopefoundation/BTrees/issues/78
- Always attempt to build the C extensions, but make their success optional.
- Always attempt to build the C extensions, but make their success
optional.
- Fix a ``DeprecationWarning`` that could come from I and L objects in
Python 2 in pure-Python mode. See https://github.com/zopefoundation/BTrees/issues/79
4.4.1 (2017-01-24)
------------------
...
...
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