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

Fix misplaced regexp flags arguments #2730

Merged
merged 2 commits into from Apr 20, 2017
Merged

Fix misplaced regexp flags arguments #2730

merged 2 commits into from Apr 20, 2017

Conversation

jwilk
Copy link
Contributor

@jwilk jwilk commented Apr 19, 2017

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
  • I tested my changes.

(I don't plan to complete this checklist myself. Sorry!)

Description

This fixes multiple invalid uses of flags in re.sub() and re.compile(...).sub() calls.
Some of these problems were found using pydiatra.

The 4th argument of re.sub() is maximum number of substitutions,
not flags.
Regular expression flags cannot be passed in the sub() method.
They have to bet set at compile time.
Copy link
Contributor

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Kwpolska Kwpolska left a comment

Choose a reason for hiding this comment

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

LGTM

@Kwpolska Kwpolska merged commit b37e435 into getnikola:master Apr 20, 2017
@felixfontein
Copy link
Contributor

Thanks a lot for noticing and fixing this, @jwilk!

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