Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regular expression related deprecation warnings with Python 3.12 #1073

Closed
1 task done
kitterma opened this issue Jan 8, 2024 · 1 comment · Fixed by #1083
Closed
1 task done

Regular expression related deprecation warnings with Python 3.12 #1073

kitterma opened this issue Jan 8, 2024 · 1 comment · Fixed by #1083
Labels
bug Something isn't working

Comments

@kitterma
Copy link
Contributor

kitterma commented Jan 8, 2024

Describe the issue

With Python 3.12, I get the following deprecation warnings:

xml2rfc/utils.py:271: SyntaxWarning: invalid escape sequence '\S'
  text = re.sub('http:\S*', replacer, text)
xml2rfc/utils.py:273: SyntaxWarning: invalid escape sequence '\S'
  text = re.sub('https:\S*', replacer, text)
xml2rfc/utils.py:289: SyntaxWarning: invalid escape sequence '\s'
  element.text = re.sub('\s*\n\s*', ' ', \
xml2rfc/utils.py:290: SyntaxWarning: invalid escape sequence '\.'
  re.sub('\.\s*\n\s*', '.  ', \
xml2rfc/utils.py:294: SyntaxWarning: invalid escape sequence '\s'
  element.tail = re.sub('\s*\n\s*', ' ', \
xml2rfc/utils.py:295: SyntaxWarning: invalid escape sequence '\.'
  re.sub('\.\s*\n\s*', '.  ', \
xml2rfc/utils.py:583: SyntaxWarning: invalid escape sequence '\w'
  match = re.findall(u'(\w+(/\w+)+)', str)
xml2rfc/writers/base.py:612: SyntaxWarning: invalid escape sequence '\g'
  initials = re.sub('([^.]) ', '\g<1>. ', initials)
xml2rfc/writers/base.py:1350: SyntaxWarning: invalid escape sequence '\d'
  if docName and not rfcnum and not re.search('-\d\d$', docName):

This looks like the regular expressions change listed in "Other Language Changes" at What’s New In Python 3.12.

This is with xml2rfc 3.19.0.

Code of Conduct

@kitterma kitterma added the bug Something isn't working label Jan 8, 2024
@jrlevine
Copy link

jrlevine commented Jan 8, 2024

Those quoted strings should all be r’…’ rather than ‘…’ or u’…’

kesara added a commit to kesara/xml2rfc that referenced this issue Jan 17, 2024
kesara added a commit that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@jrlevine @kitterma and others