Skip to content

Fix DeprecationWarnings due to invalid escape sequence#83

Closed
hugovk wants to merge 3 commits intojmoiron:masterfrom
hugovk:fix-deprecation-warning
Closed

Fix DeprecationWarnings due to invalid escape sequence#83
hugovk wants to merge 3 commits intojmoiron:masterfrom
hugovk:fix-deprecation-warning

Conversation

@hugovk
Copy link
Collaborator

@hugovk hugovk commented Jan 25, 2020

Fixes #82

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.

The solution is to use Python’s raw string notation for regular expression patterns; backslashes are not handled in any special way in a string literal prefixed with 'r'. So r"\n" is a two-character string containing '' and 'n', while "\n" is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.

https://docs.python.org/3/library/re.html


Also, EOL Python 3.3 is no longer available on Travis CI, so I removed it and added newer 3.5-3.8 to make sure 3.x passes tests on the CI.

And it looks like Travis needs re-activating for this repo, here's this PR passing on my fork:

https://travis-ci.com/hugovk/humanize/builds/146074018

Copy link

@tirkarthi tirkarthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@hugovk
Copy link
Collaborator Author

hugovk commented Jan 25, 2020

Actually, this is a duplicate of #49.

@hugovk hugovk closed this Jan 25, 2020
@hugovk hugovk deleted the fix-deprecation-warning branch January 25, 2020 21:03
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.

DeprecationWarning due to invalid escape sequences

2 participants