mirror of
https://github.com/beetbox/beets.git
synced 2025-12-09 10:05:35 +01:00
Fix Python 3.7 compatibility (#2978)
This commit is contained in:
parent
4f156b99bc
commit
15d44f02a3
2 changed files with 9 additions and 1 deletions
|
|
@ -31,6 +31,12 @@ import six
|
|||
|
||||
log = logging.getLogger('beets')
|
||||
|
||||
# The name of the type for patterns in re changed in Python 3.7.
|
||||
try:
|
||||
Pattern = re._pattern_type
|
||||
except AttributeError:
|
||||
Pattern = re.Pattern
|
||||
|
||||
|
||||
# Classes used to represent candidate options.
|
||||
|
||||
|
|
@ -433,7 +439,7 @@ class Distance(object):
|
|||
be a compiled regular expression, in which case it will be
|
||||
matched against `value2`.
|
||||
"""
|
||||
if isinstance(value1, re._pattern_type):
|
||||
if isinstance(value1, Pattern):
|
||||
return bool(value1.match(value2))
|
||||
return value1 == value2
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ New features:
|
|||
|
||||
Fixes:
|
||||
|
||||
* Fix compatibility Python 3.7 and its change to a name in the ``re`` module.
|
||||
:bug:`2978`
|
||||
* R128 normalization tags are now properly deleted from files when the values
|
||||
are missing.
|
||||
Thanks to :user:`autrimpo`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue