mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 14:52:26 +00:00
Python 3 fix: direct indexing of bytes returns an int.
This commit is contained in:
parent
58cb757816
commit
3c8550b666
@ -194,7 +194,7 @@ def flip_one_bit(s, offset=0, size=None):
|
||||
if size is None:
|
||||
size=len(s)-offset
|
||||
i = randrange(offset, offset+size)
|
||||
result = s[:i] + bchr(ord(s[i])^(0x01<<randrange(0, 8))) + s[i+1:]
|
||||
result = s[:i] + bchr(ord(s[i:i+1])^(0x01<<randrange(0, 8))) + s[i+1:]
|
||||
assert result != s, "Internal error -- flip_one_bit() produced the same string as its input: %s == %s" % (result, s)
|
||||
return result
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user