python 3.7 support: Track cpython removal of re._pattern_type
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Wed, 29 Jan 2020 09:02:00 +0000 (10:02 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 4 Feb 2020 13:17:57 +0000 (14:17 +0100)
Another sneaky backward incompatibility introduced by Python 3.7.
https://github.com/python/cpython/pull/1646

deltatar/deltatar.py

index 71bc904..a9f8a9c 100644 (file)
@@ -30,6 +30,7 @@ import shutil
 import re
 import stat
 import json
+import typing
 from functools import partial
 
 from . import tarfile
@@ -381,7 +382,7 @@ class DeltaTar(object):
                             match = PARENT_MATCH
 
                 # if it's a reg exp, then we just check if it matches
-                elif isinstance(i, re._pattern_type):
+                elif isinstance(i, typing.Pattern):
                     if i.match(path):
                         match = MATCH
                         break
@@ -413,7 +414,7 @@ class DeltaTar(object):
                         return NO_MATCH
 
                 # if it's a reg exp, then we just check if it matches
-                elif isinstance(e, re._pattern_type):
+                elif isinstance(e, typing.Pattern):
                     if e.match(path):
                         return NO_MATCH
                 else: