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

Prevent 'invalid escape sequence' errors in newer Python versions #637

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

MrSerth
Copy link
Contributor

@MrSerth MrSerth commented Apr 19, 2024

Description of the change

This PR changes two additional occurrences of RegEx character classes to work with upcoming Python versions

Benefits

The existing code continues to work with Python 3.12+. Otherwise, the following error is returned:

/sbin/my_init:25: SyntaxWarning: invalid escape sequence '\W'
  SHENV_NAME_WHITELIST_REGEX = re.compile('\W')
/sbin/my_init:96: SyntaxWarning: invalid escape sequence '\Z'
  value = re.sub('\n\Z', '', f.read())

Possible drawbacks

None, backward compatible change.

Applicable issues

None

Additional information

None

@samip5 samip5 merged commit c17acec into phusion:master Apr 19, 2024
@MrSerth MrSerth deleted the python-regex branch April 20, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants