Skip to content

Commit c8f98e1

Browse files
committed
Applied a patch from dkg@fifthhorseman.net: Fix regex manipulation for word characters.
in python 3.7, re.sub() started treating unknown escape sequences in as errors. Fix this by sending an escaped \ where we mean to pass it through raw. https://docs.python.org/3/library/re.html#re.sub - Legacy-Id: 15892
1 parent e393583 commit c8f98e1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ietf/utils/draft.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,9 @@ def extract_authors(self):
554554

555555
def make_authpat(hon, first, last, suffix):
556556
def dotexp(s):
557-
s = re.sub(r"\. ", r"\w* ", s)
558-
s = re.sub(r"\.$", r"\w*", s)
559-
s = re.sub(r"\.(\w)", r"\w* \1", s)
557+
s = re.sub(r"\. ", r"\\w* ", s)
558+
s = re.sub(r"\.$", r"\\w*", s)
559+
s = re.sub(r"\.(\w)", r"\\w* \1", s)
560560
return s
561561
first = dotexp(first)
562562
last = dotexp(last)
@@ -572,7 +572,7 @@ def dotexp(s):
572572

573573
# Some chinese names are shown with double-letter(latin) abbreviated given names, rather than
574574
# a single-letter(latin) abbreviation:
575-
first = re.sub(r"^([A-Z])[A-Z]+\\w\*", r"\1[-\w]+", first)
575+
first = re.sub(r"^([A-Z])[A-Z]+\\w\*", r"\1[-\\w]+", first)
576576

577577
# permit insertion of middle names between first and last, and
578578
# add possible honorific and suffix information

0 commit comments

Comments
 (0)