Repository: microsoft/ptvsd

Issue:
fix incorrect exception raised while processing a list that exceeds MAX_ITEMS_TO_HANDLE
## Environment data

- PTVSD version: 4.2.6
- OS and version: Windows 10
- Python version (& distribution if applicable, e.g. Anaconda): 2.7.6
- Using VS Code or Visual Studio: VS Code 

## Actual behavior

in VS Code, I ran following code and set a breakpoint to the print line and expand the lst in the debugging window. the code is:
```
lst = {}
for idx in range(0, 400):
    lst[idx] = ("blah")

print "break here and expand the lst in the debugging window"
```
And give this traceback:
```
Traceback (most recent call last):
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_frame.py", line 590, in
trace_dispatch
    self.do_wait_suspend(thread, frame, event, arg)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_frame.py", line 78, in do_wait_suspend
    self._args[0].do_wait_suspend(*args, **kwargs)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1285, in do_wait_suspend
    keep_suspended = self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1307, in _do_wait_suspend
    self.process_internal_commands()
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1024, in process_internal_commands
    int_cmd.do_it(self)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 485, in do_it
    self.method(dbg, *self.args, **self.kwargs)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 655, in internal_get_variable_json
    for child_var in variable.get_children_variables(fmt=fmt):
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_suspended_frames.py", line 108, in get_children_variables
    for key, val, evaluate_name in lst:
ValueError: need more than 2 values to unpack
Traceback (most recent call last):
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\ptvsd_launcher.py", line 45, in <module>
    main(ptvsdArgs)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\__main__.py", line 391, in main
    run()
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\__main__.py", line 272, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Python27\lib\runpy.py", line 252, in run_path
    return _run_module_code(code, init_globals, run_name, path_name)
  File "C:\Python27\lib\runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "d:\test.py", line 5, in <module>
    print "break here and expand the lst in debugging window"
  File "d:\test.py", line 5, in <module>
    print "break here and expand the lst in debugging window"
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_frame.py", line 590, in
trace_dispatch
    self.do_wait_suspend(thread, frame, event, arg)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_frame.py", line 78, in do_wait_suspend
    self._args[0].do_wait_suspend(*args, **kwargs)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1285, in do_wait_suspend
    keep_suspended = self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1307, in _do_wait_suspend
    self.process_internal_commands()
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1024, in process_internal_commands
    int_cmd.do_it(self)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 485, in do_it
    self.method(dbg, *self.args, **self.kwargs)
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 655, in internal_get_variable_json
    for child_var in variable.get_children_variables(fmt=fmt):
  File "c:\Users\test\.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_suspended_frames.py", line 108, in get_children_variables
    for key, val, evaluate_name in lst:
ValueError: need more than 2 values to unpack
```

## Expected  behavior

No exception, No debugging stops, Expand the list and show all items in the list.

## Steps to reproduce:

See above.


Discussion:

Resolving patch:
diff --git a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py
--- a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py
+++ b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py
@@ -290,7 +290,7 @@ def get_contents_debug_adapter_protocol(self, dct, fmt=None):
             eval_key_str = self.key_to_str(key)  # do not format the key
             ret.append((key_as_str, val, '[%s]' % (eval_key_str,)))
             if i > MAX_ITEMS_TO_HANDLE:
-                ret.append((TOO_LARGE_ATTR, TOO_LARGE_MSG))
+                ret.append((TOO_LARGE_ATTR, TOO_LARGE_MSG, None))
                 break
 
         ret.append(('__len__', len(dct), partial(_apply_evaluate_name, evaluate_name='len(%s)')))


Test patch:
diff --git a/src/ptvsd/_vendored/pydevd/tests_python/test_suspended_frames_manager.py b/src/ptvsd/_vendored/pydevd/tests_python/test_suspended_frames_manager.py
--- a/src/ptvsd/_vendored/pydevd/tests_python/test_suspended_frames_manager.py
+++ b/src/ptvsd/_vendored/pydevd/tests_python/test_suspended_frames_manager.py
@@ -1,5 +1,6 @@
 import sys
 from _pydevd_bundle.pydevd_constants import int_types
+from _pydevd_bundle.pydevd_resolver import MAX_ITEMS_TO_HANDLE
 
 
 def get_frame():
@@ -70,3 +71,30 @@ def test_suspended_frames_manager():
             '33': {'name': '33', 'value': "[1]", 'type': 'list', 'evaluateName': 'var3[33]'},
             '__len__': {'name': '__len__', 'value': '1', 'type': 'int', 'evaluateName': 'len(var3)'}
         })
+
+
+def get_large_frame():
+    lst = {}
+    for idx in range(0, MAX_ITEMS_TO_HANDLE + 1):
+        lst[idx] = (1)
+    return sys._getframe()
+
+def test_get_child_variables():
+    from _pydevd_bundle.pydevd_suspended_frames import SuspendedFramesManager
+    suspended_frames_manager = SuspendedFramesManager()
+    py_db = None
+    with suspended_frames_manager.track_frames(py_db) as tracker:
+        # : :type tracker: _FramesTracker
+        thread_id = 'thread1'
+        frame = get_large_frame()
+        tracker.track(thread_id, frame, frame_id_to_lineno={})
+
+        assert suspended_frames_manager.get_thread_id_for_variable_reference(id(frame)) == thread_id
+
+        variable = suspended_frames_manager.get_variable(id(frame))
+
+        for x in variable.get_children_variables():
+            try:
+                x.get_children_variables()
+            except:
+                raise AssertionError()
\ No newline at end of file