Submitter | Maciej Fijalkowski |
---|---|
Date | March 31, 2016, 4:38 p.m. |
Message ID | <9ca7854b963295b8b56d.1459442301@brick.arcode.com> |
Download | mbox | patch |
Permalink | /patch/14208/ |
State | Accepted |
Delegated to: | Pierre-Yves David |
Headers | show |
Comments
Maciej Fijalkowski <fijall@gmail.com> writes: > # HG changeset patch > # User Maciej Fijalkowski <fijall@gmail.com> > # Date 1459442288 -7200 > # Thu Mar 31 18:38:08 2016 +0200 > # Node ID 9ca7854b963295b8b56d276b903623ac8277f18d > # Parent eaaeff1b98571b90ec71614c75126e64e98c004b > tests: fix doctests for pypy optimizations > > PyPy would sometime call __len__ at points where it things preallocating > the container makes sense. Change the doctests so they're using generator > expressions and not list comprehensions Seems good to me. Might be worth it to add a comment explaining why, but I think a reviewer could add that in-flight.
On 03/31/2016 01:52 PM, Sean Farley wrote: > > Maciej Fijalkowski <fijall@gmail.com> writes: > >> # HG changeset patch >> # User Maciej Fijalkowski <fijall@gmail.com> >> # Date 1459442288 -7200 >> # Thu Mar 31 18:38:08 2016 +0200 >> # Node ID 9ca7854b963295b8b56d276b903623ac8277f18d >> # Parent eaaeff1b98571b90ec71614c75126e64e98c004b >> tests: fix doctests for pypy optimizations >> >> PyPy would sometime call __len__ at points where it things preallocating >> the container makes sense. Change the doctests so they're using generator >> expressions and not list comprehensions > > Seems good to me. Might be worth it to add a comment explaining why, but > I think a reviewer could add that in-flight. Pushed with these extra comments, Cheers,
Patch
diff -r eaaeff1b9857 -r 9ca7854b9632 mercurial/revset.py --- a/mercurial/revset.py Thu Mar 31 16:44:25 2016 +0200 +++ b/mercurial/revset.py Thu Mar 31 18:38:08 2016 +0200 @@ -3124,7 +3124,7 @@ iterate unsorted: >>> rs = addset(xs, ys) - >>> [x for x in rs] # without _genlist + >>> list(x for x in rs) # without _genlist [0, 3, 2, 5, 4] >>> assert not rs._genlist >>> len(rs) @@ -3135,7 +3135,7 @@ iterate ascending: >>> rs = addset(xs, ys, ascending=True) - >>> [x for x in rs], [x for x in rs.fastasc()] # without _asclist + >>> list(x for x in rs), list(x for x in rs.fastasc()) # without _asclist ([0, 2, 3, 4, 5], [0, 2, 3, 4, 5]) >>> assert not rs._asclist >>> len(rs) @@ -3146,7 +3146,7 @@ iterate descending: >>> rs = addset(xs, ys, ascending=False) - >>> [x for x in rs], [x for x in rs.fastdesc()] # without _asclist + >>> list(x for x in rs), list(x for x in rs.fastdesc()) # without _asclist ([5, 4, 3, 2, 0], [5, 4, 3, 2, 0]) >>> assert not rs._asclist >>> len(rs)