]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Remove dead code in the RE parser (GH-122796)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 7 Aug 2024 19:44:18 +0000 (22:44 +0300)
committerGitHub <noreply@github.com>
Wed, 7 Aug 2024 19:44:18 +0000 (19:44 +0000)
Lib/re/_parser.py

index f3c779340fe23035a618fd89d6cca2ff8181bc92..0990255b22c219b778583d4e6580736ab5866f22 100644 (file)
@@ -807,14 +807,6 @@ def _parse(source, state, verbose, nested, first=False):
                             state.grouprefpos[condgroup] = (
                                 source.tell() - len(condname) - 1
                             )
-                        if not (condname.isdecimal() and condname.isascii()):
-                            import warnings
-                            warnings.warn(
-                                "bad character in group name %s at position %d" %
-                                (repr(condname) if source.istext else ascii(condname),
-                                 source.tell() - len(condname) - 1),
-                                DeprecationWarning, stacklevel=nested + 6
-                            )
                     state.checklookbehindgroup(condgroup, source)
                     item_yes = _parse(source, state, verbose, nested + 1)
                     if source.match("|"):
@@ -1038,14 +1030,6 @@ def parse_template(source, pattern):
                     if index >= MAXGROUPS:
                         raise s.error("invalid group reference %d" % index,
                                       len(name) + 1)
-                    if not (name.isdecimal() and name.isascii()):
-                        import warnings
-                        warnings.warn(
-                            "bad character in group name %s at position %d" %
-                            (repr(name) if s.istext else ascii(name),
-                             s.tell() - len(name) - 1),
-                            DeprecationWarning, stacklevel=5
-                        )
                 addgroup(index, len(name) + 1)
             elif c == "0":
                 if s.next in OCTDIGITS: