Skip to content

Commit

Permalink
Fix tests for python 3.7
Browse files Browse the repository at this point in the history
python 3.7 removes re._pattern_type. Fix the one place where we were
depending on the type of regular expressions to compute the type
dynamically.

llvm-svn: 350093
  • Loading branch information
labath committed Dec 27, 2018
1 parent ddd0682 commit 9294a26
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lldb/packages/Python/lldbsuite/test/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ def fn_neq(x, y): return x != y
LooseVersion(expected_str))


_re_pattern_type = type(re.compile(''))
def _match_decorator_property(expected, actual):
if actual is None or expected is None:
return True

if isinstance(expected, no_match):
return not _match_decorator_property(expected.item, actual)
elif isinstance(expected, (re._pattern_type,) + six.string_types):
elif isinstance(expected, (_re_pattern_type,) + six.string_types):
return re.search(expected, actual) is not None
elif hasattr(expected, "__iter__"):
return any([x is not None and _match_decorator_property(x, actual)
Expand Down

0 comments on commit 9294a26

Please sign in to comment.