summaryrefslogtreecommitdiffstats
path: root/Lib/timeit.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-05-20 04:59:56 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-05-20 04:59:56 (GMT)
commit22952a3efc4813d3aecbe1a7840d6981f0a1e29d (patch)
tree4f5198816dac4c6afe7cc4b4db12a9dadf17b73a /Lib/timeit.py
parent235d1efe12817d78c574af7b942c47d4ff94feae (diff)
downloadcpython-22952a3efc4813d3aecbe1a7840d6981f0a1e29d.zip
cpython-22952a3efc4813d3aecbe1a7840d6981f0a1e29d.tar.gz
cpython-22952a3efc4813d3aecbe1a7840d6981f0a1e29d.tar.bz2
SF bug 735293: Command line timeit.py sets sys.path badly
Paul Moore's patch to have timeit.py check the current directory for imports (instead of the directory for Lib/timeit.py).
Diffstat (limited to 'Lib/timeit.py')
-rw-r--r--Lib/timeit.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/timeit.py b/Lib/timeit.py
index 9870954..4ad4a39e5 100644
--- a/Lib/timeit.py
+++ b/Lib/timeit.py
@@ -236,6 +236,11 @@ def main(args=None):
print __doc__,
return 0
setup = "\n".join(setup) or "pass"
+ # Include the current directory, so that local imports work (sys.path
+ # contains the directory of this script, rather than the current
+ # directory)
+ import os
+ sys.path.insert(0, os.curdir)
t = Timer(stmt, setup, timer)
if number == 0:
# determine number so that 0.2 <= total time < 2.0