Issue55222 (#55223)
* Python 3.7 compatibility for re.Pattern (Fixes #55222) * Python 3.7 compatibility for re.Pattern (Fixes #55222)pull/4420/head
parent
49ecfdbc10
commit
0ee673a558
|
@ -41,6 +41,12 @@ DEFAULT_IGNORE_LINES_RE = set([
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
Pattern = re._pattern_type
|
||||||
|
except AttributeError:
|
||||||
|
Pattern = re.Pattern
|
||||||
|
|
||||||
|
|
||||||
class ConfigLine(object):
|
class ConfigLine(object):
|
||||||
|
|
||||||
def __init__(self, raw):
|
def __init__(self, raw):
|
||||||
|
@ -162,7 +168,7 @@ class NetworkConfig(object):
|
||||||
|
|
||||||
if ignore_lines:
|
if ignore_lines:
|
||||||
for item in ignore_lines:
|
for item in ignore_lines:
|
||||||
if not isinstance(item, re._pattern_type):
|
if not isinstance(item, Pattern):
|
||||||
item = re.compile(item)
|
item = re.compile(item)
|
||||||
DEFAULT_IGNORE_LINES_RE.add(item)
|
DEFAULT_IGNORE_LINES_RE.add(item)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue