Skip to content

Commit

Permalink
SF bug 735293: Command line timeit.py sets sys.path badly
Browse files Browse the repository at this point in the history
Paul Moore's patch to have timeit.py check the current directory for
imports (instead of the directory for Lib/timeit.py).
  • Loading branch information
rhettinger committed May 20, 2003
1 parent 235d1ef commit 22952a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/timeit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ Trent Mick
Roman Milner
Dom Mitchell
Doug Moen
Paul Moore
The Dragon De Monsyne
Skip Montanaro
James A Morrison
Expand Down
2 changes: 2 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------

Expand Down

0 comments on commit 22952a3

Please sign in to comment.