-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failing iterable check on types #8
Comments
@rpkilby can you provide an example of the failure? |
@rpkilby Hi. I will change this algorithm to use a recursive approach. For now if you are blocked you can use sys.setrecursionlimit. Good catch! |
Yep >>> from collections import OrderedDict
>>> from pysize import get_size
>>> get_size(OrderedDict)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/bagel/Documents/django-rest-framework-filters/pysize.py", line 26, in get_size
size += sum((get_size(i, seen) for i in obj))
TypeError: 'type' object is not iterable |
@bosswissam - it's not a recursion issue, just a simple |
Basically, Hope that helps. |
@rpkilby Apologies I seem to have had another issues open and left a comment on this one mistakenly. Yup will make this change, also feel free to send a PR if you'd like. |
Please correct me if I'm wrong, but if a elif hasattr(obj, '__iter__') and not isinstance(obj, (type, str, bytes, bytearray)): |
Hi. The iterable check on Line 25 doesn't work when encountering types.
pysize/pysize.py
Line 25 in e94d25c
I believe this should be changed to
The text was updated successfully, but these errors were encountered: