[pypy-commit] pypy default: Try to protect against recursion
arigo
noreply at buildbot.pypy.org
Mon Apr 20 13:49:50 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r76850:d1780357bcfa
Date: 2015-04-20 13:49 +0200
http://bitbucket.org/pypy/pypy/changeset/d1780357bcfa/
Log: Try to protect against recursion
diff --git a/pypy/tool/gdb_pypy.py b/pypy/tool/gdb_pypy.py
--- a/pypy/tool/gdb_pypy.py
+++ b/pypy/tool/gdb_pypy.py
@@ -251,6 +251,8 @@
fields
"""
+ recursive = False
+
def __init__(self, val):
self.val = val
@@ -278,11 +280,18 @@
allocated = int(array['length'])
items = array['items']
allocstr = ', alloc=%d' % allocated
- itemlist = []
- for i in range(length):
- item = items[i]
- itemlist.append(str(item))
- str_items = ', '.join(itemlist)
+ if RPyListPrinter.recursive:
+ str_items = '...'
+ else:
+ RPyListPrinter.recursive = True
+ try:
+ itemlist = []
+ for i in range(length):
+ item = items[i]
+ itemlist.append(str(item)) # may recurse here
+ str_items = ', '.join(itemlist)
+ finally:
+ RPyListPrinter.recursive = False
return 'r[%s] (len=%d%s)' % (str_items, length, allocstr)
More information about the pypy-commit
mailing list