Skip to content

Commit

Permalink
Handle empty strings for IntegerType values
Browse files Browse the repository at this point in the history
  • Loading branch information
thobbs committed Jul 19, 2013
1 parent 67a9fd1 commit 6529a7d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pycassa/marshal.py
Expand Up @@ -399,7 +399,8 @@ def encode_int(x, *args):
return ''.join(reversed(out))

def decode_int(term, *args):
val = int(term.encode('hex'), 16)
if (ord(term[0]) & 128) != 0:
val = val - (1 << (len(term) * 8))
return val
if term != "":
val = int(term.encode('hex'), 16)
if (ord(term[0]) & 128) != 0:
val = val - (1 << (len(term) * 8))
return val

0 comments on commit 6529a7d

Please sign in to comment.