mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
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).
This commit is contained in:
parent
235d1efe12
commit
22952a3efc
3 changed files with 8 additions and 0 deletions
|
|
@ -236,6 +236,11 @@ def main(args=None):
|
||||||
print __doc__,
|
print __doc__,
|
||||||
return 0
|
return 0
|
||||||
setup = "\n".join(setup) or "pass"
|
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)
|
t = Timer(stmt, setup, timer)
|
||||||
if number == 0:
|
if number == 0:
|
||||||
# determine number so that 0.2 <= total time < 2.0
|
# determine number so that 0.2 <= total time < 2.0
|
||||||
|
|
|
||||||
|
|
@ -370,6 +370,7 @@ Trent Mick
|
||||||
Roman Milner
|
Roman Milner
|
||||||
Dom Mitchell
|
Dom Mitchell
|
||||||
Doug Moen
|
Doug Moen
|
||||||
|
Paul Moore
|
||||||
The Dragon De Monsyne
|
The Dragon De Monsyne
|
||||||
Skip Montanaro
|
Skip Montanaro
|
||||||
James A Morrison
|
James A Morrison
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ Library
|
||||||
- Fixed socket speed loss caused by use of the _socketobject wrapper class
|
- Fixed socket speed loss caused by use of the _socketobject wrapper class
|
||||||
in socket.py.
|
in socket.py.
|
||||||
|
|
||||||
|
- timeit.py now checks the current directory for imports.
|
||||||
|
|
||||||
Tools/Demos
|
Tools/Demos
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue