diff options
Diffstat (limited to 'coverage/numbits.py')
-rw-r--r-- | coverage/numbits.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/coverage/numbits.py b/coverage/numbits.py index 6ca96fbc..7205b9f1 100644 --- a/coverage/numbits.py +++ b/coverage/numbits.py @@ -15,22 +15,14 @@ the future. Use these functions to work with those binary blobs of data. """ import json -from coverage import env from coverage.backward import byte_to_int, bytes_to_ints, binary_bytes, zip_longest from coverage.misc import contract, new_contract -if env.PY3: - def _to_blob(b): - """Convert a bytestring into a type SQLite will accept for a blob.""" - return b +def _to_blob(b): + """Convert a bytestring into a type SQLite will accept for a blob.""" + return b - new_contract('blob', lambda v: isinstance(v, bytes)) -else: - def _to_blob(b): - """Convert a bytestring into a type SQLite will accept for a blob.""" - return buffer(b) # pylint: disable=undefined-variable - - new_contract('blob', lambda v: isinstance(v, buffer)) # pylint: disable=undefined-variable +new_contract('blob', lambda v: isinstance(v, bytes)) @contract(nums='Iterable', returns='blob') |