diff options
Diffstat (limited to 'pathod')
-rw-r--r-- | pathod/language/generators.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pathod/language/generators.py b/pathod/language/generators.py index 9fff3082..68705941 100644 --- a/pathod/language/generators.py +++ b/pathod/language/generators.py @@ -3,6 +3,7 @@ import random import mmap import six +import sys DATATYPES = dict( ascii_letters=string.ascii_letters.encode(), @@ -68,7 +69,7 @@ class RandomGenerator(object): def __getitem__(self, x): chars = DATATYPES[self.dtype] if isinstance(x, slice): - return b"".join(rand_byte(chars) for _ in range(*x.indices(self.length))) + return b"".join(rand_byte(chars) for _ in range(*x.indices(min(self.length, sys.maxsize)))) return rand_byte(chars) def __repr__(self): |