]> granicus.if.org Git - python/commitdiff
SF bug 735293: Command line timeit.py sets sys.path badly
authorRaymond Hettinger <python@rcn.com>
Tue, 20 May 2003 04:59:56 +0000 (04:59 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 20 May 2003 04:59:56 +0000 (04:59 +0000)
Paul Moore's patch to have timeit.py check the current directory for
imports (instead of the directory for Lib/timeit.py).

Lib/timeit.py
Misc/ACKS
Misc/NEWS

index 9870954dfe6948e63223e24090c892c25698abbb..4ad4a39e550e676ae2a917fa8bccb9b49e89d22a 100644 (file)
@@ -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
index a2afed18b064baea3f82ce67beefac6c6c1f2a10..3f1ac93dfe494f100ea9115c9f3a5dc22ea3be1d 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -370,6 +370,7 @@ Trent Mick
 Roman Milner
 Dom Mitchell
 Doug Moen
+Paul Moore
 The Dragon De Monsyne
 Skip Montanaro
 James A Morrison
index 3a819b881f182fcedd884cf3160f064496222486..b3517114d773be56458ae4fb456253a9953c6c4b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -58,6 +58,8 @@ Library
 - Fixed socket speed loss caused by use of the _socketobject wrapper class
   in socket.py.
 
+- timeit.py now checks the current directory for imports.
+
 Tools/Demos
 -----------