Commit 2453a600 authored by Jeremy Hylton's avatar Jeremy Hylton

Handle list and tuple with the same branch in short_repr().

XXX thought I already checked this in.
parent 5a77f3e7
...@@ -45,7 +45,7 @@ def short_repr(obj): ...@@ -45,7 +45,7 @@ def short_repr(obj):
# The pickle is near the beginning, too, and you can often fit the # The pickle is near the beginning, too, and you can often fit the
# module name in the pickle. # module name in the pickle.
if isinstance(obj, types.StringType): if isinstance(obj, str):
if len(obj) > REPR_LIMIT: if len(obj) > REPR_LIMIT:
r = repr(obj[:REPR_LIMIT]) r = repr(obj[:REPR_LIMIT])
else: else:
...@@ -53,7 +53,7 @@ def short_repr(obj): ...@@ -53,7 +53,7 @@ def short_repr(obj):
if len(r) > REPR_LIMIT: if len(r) > REPR_LIMIT:
r = r[:REPR_LIMIT-4] + '...' + r[-1] r = r[:REPR_LIMIT-4] + '...' + r[-1]
return r return r
elif isinstance(obj, types.TupleType): elif isinstance(obj, (list, tuple)):
elts = [] elts = []
size = 0 size = 0
for elt in obj: for elt in obj:
...@@ -62,7 +62,10 @@ def short_repr(obj): ...@@ -62,7 +62,10 @@ def short_repr(obj):
size += len(r) size += len(r)
if size > REPR_LIMIT: if size > REPR_LIMIT:
break break
if isinstance(obj, tuple):
r = "(%s)" % (", ".join(elts)) r = "(%s)" % (", ".join(elts))
else:
r = "[%s]" % (", ".join(elts))
else: else:
r = repr(obj) r = repr(obj)
if len(r) > REPR_LIMIT: if len(r) > REPR_LIMIT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment