classification
Title: fix for timeit when the statement is a string and the setup is not (and tests)
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.3, Python 3.2, Python 3.1
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, michael.henry, r.david.murray, rhettinger, tdriscol
Priority: normal Keywords: patch

Created on 2009-03-31 21:01 by tdriscol, last changed 2013-03-28 10:03 by georg.brandl.

Files
File name Uploaded Description Edit
timeit_issue_5633.patch michael.henry, 2011-03-16 22:19 Adds unit tests and an alternative fix for this bug review
Messages (4)
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) * (Python committer) 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) * (Python committer) 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.
History
Date User Action Args
2013-03-28 10:03:03georg.brandlsetassignee: georg.brandl ->
2012-06-25 17:56:54tshepangsettitle: 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:47michael.henrysetfiles: + 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:46georg.brandlsetmessages: + msg84933
2009-03-31 21:17:26rhettingersetassignee: rhettinger -> georg.brandl

messages: + msg84910
nosy: + georg.brandl
2009-03-31 21:10:43tdriscolsettitle: 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:50rhettingersetassignee: rhettinger

nosy: + rhettinger
2009-03-31 21:01:38tdriscolcreate