Issue55222 (#55223)

* Python 3.7 compatibility for re.Pattern (Fixes #55222)

* Python 3.7 compatibility for re.Pattern (Fixes #55222)
This commit is contained in:
Albert Siersema 2019-05-14 15:28:43 +02:00 committed by Nilashish Chakraborty
parent 49ecfdbc10
commit 0ee673a558

View file

@ -41,6 +41,12 @@ DEFAULT_IGNORE_LINES_RE = set([
])
try:
Pattern = re._pattern_type
except AttributeError:
Pattern = re.Pattern
class ConfigLine(object):
def __init__(self, raw):
@ -162,7 +168,7 @@ class NetworkConfig(object):
if ignore_lines:
for item in ignore_lines:
if not isinstance(item, re._pattern_type):
if not isinstance(item, Pattern):
item = re.compile(item)
DEFAULT_IGNORE_LINES_RE.add(item)