mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Fixes exception in django cause by long iter check (#443)
* Fixes exception in django cause by long iter check * Fix linter error
This commit is contained in:
parent
63130cd36e
commit
0866c0c830
1 changed files with 10 additions and 0 deletions
|
|
@ -27,11 +27,15 @@ class SafeRepr(object):
|
|||
set_info = (set, '{', '}', False)
|
||||
frozenset_info = (frozenset, 'frozenset({', '})', False)
|
||||
int_types = (int,)
|
||||
long_iter_types = (list, tuple, bytearray, range,
|
||||
dict, set, frozenset)
|
||||
else:
|
||||
string_types = (str, unicode)
|
||||
set_info = (set, 'set([', '])', False)
|
||||
frozenset_info = (frozenset, 'frozenset([', '])', False)
|
||||
int_types = (int, long) # noqa
|
||||
long_iter_types = (list, tuple, bytearray, xrange,
|
||||
dict, set, frozenset, buffer) # noqa
|
||||
|
||||
# Collection types are recursively iterated for each limit in
|
||||
# maxcollection.
|
||||
|
|
@ -125,6 +129,12 @@ class SafeRepr(object):
|
|||
if not hasattr(obj, '__iter__'):
|
||||
return False
|
||||
|
||||
# If it's not an instance of these collection types then it
|
||||
# is fine. Note: this is a fix for
|
||||
# https://github.com/Microsoft/ptvsd/issues/406
|
||||
if not isinstance(obj, self.long_iter_types):
|
||||
return False
|
||||
|
||||
# Iterable is its own iterator - this is a one-off iterable
|
||||
# like generator or enumerate(). We can't really count that,
|
||||
# but repr() for these should not include any elements anyway,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue