From 22952a3efc4813d3aecbe1a7840d6981f0a1e29d Mon Sep 17 00:00:00 2001
From: Raymond Hettinger <python@rcn.com>
Date: Tue, 20 May 2003 04:59:56 +0000
Subject: 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).
---
 Lib/timeit.py | 5 +++++
 Misc/ACKS     | 1 +
 Misc/NEWS     | 2 ++
 3 files changed, 8 insertions(+)

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
diff --git a/Misc/ACKS b/Misc/ACKS
index a2afed1..3f1ac93 100644
--- 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
diff --git a/Misc/NEWS b/Misc/NEWS
index 3a819b8..b351711 100644
--- 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
 -----------
 
-- 
cgit v0.12