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

Marked regexp patterns as raw strings and bytes to address the invalid escape warning on Python 3.6+ #1057

Merged
merged 2 commits into from May 10, 2017

Conversation

ygingras
Copy link
Contributor

@ygingras ygingras commented May 9, 2017

Starting with 3.6.0, invalid escapes in string and byte literals trigger a DepreacationWarning. This diff marks regexp patterns where such escapes occur as "raw". There are probably other occurrences for non-Linux platforms, but since I can't test chances for such platforms I elected to not to make the changes.

@giampaolo
Copy link
Owner

Hello. Invalid because the have just one slash \?

Copy link

@mjpieters mjpieters left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM.

@@ -1690,7 +1690,7 @@ def num_ctx_switches(self, _ctxsw_re=re.compile(b'ctxt_switches:\t(\d+)')):
return _common.pctxsw(int(ctxsw[0]), int(ctxsw[1]))

@wrap_exceptions
def num_threads(self, _num_threads_re=re.compile(b'Threads:\t(\d+)')):
def num_threads(self, _num_threads_re=re.compile(br'hreads:\t(\d+)')):

Choose a reason for hiding this comment

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

This line is now missing the initial T

@giampaolo
Copy link
Owner

How do you see the warnings? I tried make test PYTHON=python3.7 but it prints no warnings.

@giampaolo
Copy link
Owner

Also tried warnings.simplefilter('always') before running tests and still no warnings.

@giampaolo
Copy link
Owner

Oh, I see, I was supposed to clean all pyc files first. LGTM except #1057 (comment)

@giampaolo giampaolo merged commit a203638 into giampaolo:master May 10, 2017
@ygingras
Copy link
Contributor Author

Awesome guys! Thank you for being so fast and thorough with the review.

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

3 participants