From 62360ad874498a0c781128807387a85e2d17b2ee Mon Sep 17 00:00:00 2001 From: deathaxe Date: Wed, 19 Jul 2023 18:35:16 +0200 Subject: [PATCH] Fix regexp global tokens not at pattern start issue Python 3.12 complains about `(?x)` flag not being located at the beginning of the pattern. Note: May be relevant for packagecontrol.io which also uses parts of this plugin. --- package_control/deps/semver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package_control/deps/semver.py b/package_control/deps/semver.py index 5d59d495..1ac82e22 100644 --- a/package_control/deps/semver.py +++ b/package_control/deps/semver.py @@ -123,14 +123,14 @@ class SemVer(namedtuple("_SemVer", 'major, minor, patch, prerelease, build')): """ # Static class variables - _base_regex = r'''(?x) + _base_regex = r''' (?P[0-9]+) \.(?P[0-9]+) \.(?P[0-9]+) (?:\-(?P(?:[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?))? (?:\+(?P(?:[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?))?''' - _search_regex = re.compile(_base_regex) - _match_regex = re.compile('^%s$' % _base_regex) # required because of $ anchor + _search_regex = re.compile(r'(?x)%s' % _base_regex) + _match_regex = re.compile(r'(?x)^%s$' % _base_regex) # required because of $ anchor # "Constructor" def __new__(cls, *args, **kwargs):