@@ -211,6 +211,7 @@ def pttl(self, key):
211
211
return long (- 2 ) if self .strict else None
212
212
if key not in self .timeouts :
213
213
# as of redis 2.8, -1 is returned if the key is persistent
214
+ # redis-py returns None; command docs say -1
214
215
return long (- 1 ) if self .strict else None
215
216
216
217
time_to_live = get_total_milliseconds (self .timeouts [key ] - self .clock .now ())
@@ -472,20 +473,20 @@ def hset(self, hashkey, attribute, value):
472
473
473
474
redis_hash = self ._get_hash (hashkey , 'HSET' , create = True )
474
475
attribute = self ._encode (attribute )
475
- was_present = attribute in redis_hash
476
+ attribute_present = attribute in redis_hash
476
477
redis_hash [attribute ] = self ._encode (value )
477
- return 0 if was_present else 1
478
+ return long ( 0 ) if attribute_present else long ( 1 )
478
479
479
480
def hsetnx (self , hashkey , attribute , value ):
480
481
"""Emulate hsetnx."""
481
482
482
483
redis_hash = self ._get_hash (hashkey , 'HSETNX' , create = True )
483
484
attribute = self ._encode (attribute )
484
485
if attribute in redis_hash :
485
- return 0
486
+ return long ( 0 )
486
487
else :
487
488
redis_hash [attribute ] = self ._encode (value )
488
- return 1
489
+ return long ( 1 )
489
490
490
491
def hincrby (self , hashkey , attribute , increment = 1 ):
491
492
"""Emulate hincrby."""
0 commit comments