Commit 9cdf9f3c authored by Jason Swails's avatar Jason Swails
Browse files

Also catch ValueError in _is_string. Fix indentation to be consistent (5 spaces

to 4 -- this would be a SyntaxError in Python3).
parent b661807c
...@@ -219,19 +219,21 @@ class State(_object): ...@@ -219,19 +219,21 @@ class State(_object):
# Strings can cause trouble # Strings can cause trouble
# as can any container that has infinite levels of containment # as can any container that has infinite levels of containment
def _is_string(x): def _is_string(x):
# step 1) String is always a container # step 1) String is always a container
# and its contents are themselves containers. # and its contents are themselves containers.
try: try:
first_item = iter(x).next() first_item = iter(x).next()
inner_item = iter(first_item).next() inner_item = iter(first_item).next()
if first_item == inner_item: if first_item == inner_item:
return True return True
else: else:
return False return False
except TypeError: except TypeError:
return False return False
except StopIteration: except StopIteration:
return False return False
except ValueError:
return False
def stripUnits(args): def stripUnits(args):
""" """
......
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