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:
parent
49ecfdbc10
commit
0ee673a558
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue