Skip to content

Commit 5be3440

Browse files
committed
-
1 parent 1df3f4a commit 5be3440

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

source_py3/python_toolbox/misc_tools/misc_tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,9 @@ def decimal_number_from_string(string):
363363

364364
class AlternativeLengthMixin:
365365
def __len__(self):
366-
if self.length <= sys.maxsize:
367-
return self.length
366+
length = self.length
367+
if (length <= sys.maxsize) and isinstance(length, int):
368+
return length
368369
else:
369370
raise OverflowError("Due to CPython limitation, you'll have to "
370371
"use `.length` rather than `len`")

source_py3/python_toolbox/nifty_collections/lazy_tuple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __init__(self, iterable, definitely_infinite=False):
8686
self.exhausted = True if was_given_a_sequence else False
8787
'''Flag saying whether the internal iterator is totally exhausted.'''
8888

89-
self.collected_data = list(iterable) if was_given_a_sequence else []
89+
self.collected_data = iterable if was_given_a_sequence else []
9090
'''All the items that were collected from the iterable.'''
9191

9292
self._iterator = None if was_given_a_sequence else iter(iterable)

0 commit comments

Comments
 (0)