msg84902 - (view) |
Author: Tim Driscoll (tdriscol) |
Date: 2009-03-31 21:01 |
The patch and test is here:
http://codereview.appspot.com/28161/show
There were no tests so i added a few of them. The one that breaks
without the patch to timeit is:
test_setup_is_called_when_the_statment_is_string_and_the_setup_is_not()
(sorry for the long name)
Even if the patch is no good perhaps the test could be useful.
|
msg84910 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2009-03-31 21:17 |
Georg, this was your patch: http://bugs.python.org/issue1533909
I don't think it should have been accepted so readily. It is not
harmonious with all of the other proposals for improving timeit.
No that it is out in the wild, I think all you can do is fix-up the docs.
Also, the inner template function should have a func=func argument so
that the func() call is localized. This affects the timings. Part of
the concept of the module is to make the surrounding timing apparatus be
as light-weight as possible so that the timings reflect the thing being
timed without being obscured by the overhead of the timing module itself.
|
msg84933 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2009-03-31 22:07 |
I'll look at it.
|
msg131184 - (view) |
Author: Michael Henry (michael.henry) * |
Date: 2011-03-16 22:19 |
Issue #11578 added unit tests for timeit.py. Because of this bug, two tests
were omitted. In the attached patch are the previously withheld unit tests
and an alternate method of fixing the bug (developed before Tim's fix was
noticed). It's not clear to me what timing-related issues influence the
strategy for fixing this bug.
|
msg243086 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-05-13 13:44 |
Definitely there is a bug. The code of timeit is written to support string stmt and callable setup. Expected that locals available when the function is created, would be available when the function is executed. But this doesn't work. May be it worked in the earlier Python, I don't know. Due to the lack of tests this was unnoticed.
Here is simpler patch that fixes the support of callable setup with string stmt.
But I like Tim's approach (compile testing function using the single template), it makes the implementation simpler. I'll try to adapt it for current sources.
|
msg243094 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-05-13 14:36 |
Here is more complicated patch, that not only fixes handling of callable setup, but also simplifies the implementation of timeit constructor.
|
msg244471 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2015-05-30 16:46 |
New changeset 14d1018940cb by Serhiy Storchaka in branch '2.7':
Issue #5633: Fixed timeit when the statement is a string and the setup is not.
https://hg.python.org/cpython/rev/14d1018940cb
New changeset 89de73c0d848 by Serhiy Storchaka in branch '3.4':
Issue #5633: Fixed timeit when the statement is a string and the setup is not.
https://hg.python.org/cpython/rev/89de73c0d848
New changeset faea7c8bcb13 by Serhiy Storchaka in branch '3.5':
Issue #5633: Fixed timeit when the statement is a string and the setup is not.
https://hg.python.org/cpython/rev/faea7c8bcb13
New changeset fd01cbe4336e by Serhiy Storchaka in branch 'default':
Issue #5633: Fixed timeit when the statement is a string and the setup is not.
https://hg.python.org/cpython/rev/fd01cbe4336e
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:47 | admin | set | github: 49883 |
2015-05-30 16:55:14 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
2015-05-30 16:46:06 | python-dev | set | nosy:
+ python-dev messages:
+ msg244471
|
2015-05-30 16:18:52 | serhiy.storchaka | set | assignee: serhiy.storchaka versions:
+ Python 3.6 |
2015-05-13 14:36:36 | serhiy.storchaka | set | files:
+ timeit_callable_setup_refactor.patch
messages:
+ msg243094 |
2015-05-13 13:45:03 | serhiy.storchaka | set | files:
+ timeit_callable_setup.patch |
2015-05-13 13:44:48 | serhiy.storchaka | set | versions:
+ Python 2.7, Python 3.4, Python 3.5, - Python 3.1, Python 3.2, Python 3.3 nosy:
+ serhiy.storchaka
messages:
+ msg243086
stage: patch review |
2013-03-28 10:03:03 | georg.brandl | set | assignee: georg.brandl -> (no value) |
2012-06-25 17:56:54 | tshepang | set | title: fix for timeit when the statment is a string and the setup is not (and tests) -> fix for timeit when the statement is a string and the setup is not (and tests) |
2011-03-16 22:19:47 | michael.henry | set | files:
+ timeit_issue_5633.patch versions:
+ Python 3.2, Python 3.3 nosy:
+ r.david.murray, michael.henry
messages:
+ msg131184
keywords:
+ patch |
2009-03-31 22:07:46 | georg.brandl | set | messages:
+ msg84933 |
2009-03-31 21:17:26 | rhettinger | set | assignee: rhettinger -> georg.brandl
messages:
+ msg84910 nosy:
+ georg.brandl |
2009-03-31 21:10:43 | tdriscol | set | title: timeit breaks when the statment is a string and the setup is not -> fix for timeit when the statment is a string and the setup is not (and tests) |
2009-03-31 21:04:50 | rhettinger | set | assignee: rhettinger
nosy:
+ rhettinger |
2009-03-31 21:01:38 | tdriscol | create | |