-
Notifications
You must be signed in to change notification settings - Fork 118
Description
General information
- SDK/Library version: 4.9.0 (I also checked the latest code and it's still an issue)
- Environment: doesn't matter, I think
- Language, language version, and OS: Python 3.8
Issue description
According to https://docs.python.org/3/library/re.html, some of the regex strings might lead to syntax errors in future python versions:
Regular expressions use the backslash character ('') to indicate special forms or to allow special characters to be used without invoking their special meaning. This collides with Python’s usage of the same character for the same purpose in string literals; for example, to match a literal backslash, one might have to write '\\' as the pattern string, because the regular expression must be \, and each backslash must be expressed as \ inside a regular Python string literal. Also, please note that any invalid escape sequences in Python’s usage of the backslash in string literals now generate a DeprecationWarning and in the future this will become a SyntaxError. This behaviour will happen even if it is a valid escape sequence for a regular expression.
For example:
virtualenv/lib/python3.8/site-packages/braintree/util/parser.py:13: DeprecationWarning: invalid escape sequence \s
self.doc = minidom.parseString("><".join(re.split(">\s+<", xml)).strip())
I think the solution is just to convert all regex strings to the raw r"..."
format. But I'm not sure on backwards compatibility on that...