( )⚙ D2866 contrib: fix a subtle bug in check-code's regex rewriting

This is an archive of the discontinued Mercurial Phabricator instance.

contrib: fix a subtle bug in check-code's regex rewriting
ClosedPublic

Authored by durin42 on Mar 14 2018, 3:53 PM.

Details

Summary

We rewrite \s to [ \t] when preparing our regular expressions, but
we previously weren't working to avoid having nested sets. Previously,
Python let this slide without incident, but in Python 3.7 wants to
make sure you meant an actual [ in a set, and so this warns. This
appears to be fortunate for us, because [\s(] was getting rewritten
to be [[ \t](] which doesn't actually match what we expected. See
preceding changes that were revealed to be necessary after
implementing this fix.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

durin42 created this revision.Mar 14 2018, 3:53 PM
pulkit accepted this revision.Mar 15 2018, 8:32 AM
pulkit added a subscriber: pulkit.

Looks good to me but I am not feeling confident enough to push this. Queued the first three.

This revision was automatically updated to reflect the committed changes.