Submitter | Simon Heimberg |
---|---|
Date | June 8, 2013, 6:57 p.m. |
Message ID | <6f047263d6db2ac50b79.1370717823@lapsi.heimberg.home> |
Download | mbox | patch |
Permalink | /patch/1713/ |
State | Changes Requested, archived |
Headers | show |
Comments
On Sat, 2013-06-08 at 20:57 +0200, Simon Heimberg wrote: > # HG changeset patch > # User Simon Heimberg <simohe@besonet.ch> > # Date 1370715614 -7200 > # Node ID 6f047263d6db2ac50b79a69d9bbb3379ccaf63b3 > # Parent e12f745ed2b4c38ac0acb2c8f7c2cebe3b130f3f > check-code: use new function for compiling regexp patterns > > This gives some speed gain when re2 is installed. My test server happens to have re2 installed: + for m in p.finditer(post): + AttributeError: '_re2.RE2_Regexp' object has no attribute 'finditer' I've queued the first four patches for default, thanks.
There are two implementations of re2 Facebooks implementation does not have finditer https://github.com/facebook/pyre2/blob/master/README.rst#missing-features But the one from axiak does https://github.com/axiak/pyre2/blob/master/src/re2.pyx#L513
On Thu, 2013-06-13 at 01:34 +0200, Simon Heimberg wrote: > There are two implementations of re2 > > Facebooks implementation does not have finditer > https://github.com/facebook/pyre2/blob/master/README.rst#missing-features > But the one from axiak does > https://github.com/axiak/pyre2/blob/master/src/re2.pyx#L513 This popped up a couple days ago: http://bz.selenic.com/show_bug.cgi?id=3964 ..which makes me inclined to pass on axiak-only support for now. If we can tweak check-code to not use finditer and thus be bi-compatible, that'd be great. (As it happens, my own test servers come with Facebook's version pre-installed, which makes it a nuisance for me to even test the axiak version.)
Patch
diff -r e12f745ed2b4 -r 6f047263d6db contrib/check-code.py --- a/contrib/check-code.py Sam Jun 08 20:20:14 2013 +0200 +++ b/contrib/check-code.py Sam Jun 08 20:20:14 2013 +0200 @@ -344,10 +344,10 @@ p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) #print po, '=>', p - pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:] + pats[i] = (compilere(p, multiline=True),) + pseq[1:] filters = c[2] for i, flt in enumerate(filters): - filters[i] = re.compile(flt[0]), flt[1] + filters[i] = compilere(flt[0]), flt[1] _preparepats() class norepeatlogger(object):