summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2009-11-15 23:27:31 +0000
committerNick Coghlan <ncoghlan@gmail.com>2009-11-15 23:27:31 +0000
commitb830a230c1718f23bccf6e0af9e3d8d32ef57b2c (patch)
tree516a52554155077e06dc5d1c9566fd9698eace9c
parentf5b3a1498c32c70afe3d0baa25d83d112cab277f (diff)
downloadcpython-git-b830a230c1718f23bccf6e0af9e3d8d32ef57b2c.tar.gz
Recorded merge of revisions 76314 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76314 | nick.coghlan | 2009-11-16 09:04:33 +1000 (Mon, 16 Nov 2009) | 9 lines Merged revisions 76312 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76312 | nick.coghlan | 2009-11-16 08:36:47 +1000 (Mon, 16 Nov 2009) | 1 line Issue #7328: don't corrupt sys.path when running pydoc with the -m switch ........ ................
-rwxr-xr-xLib/pydoc.py12
-rw-r--r--Misc/NEWS2
2 files changed, 9 insertions, 5 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 68771c9f08..28d3bb8c5f 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -2249,11 +2249,13 @@ def cli():
import getopt
class BadUsage(Exception): pass
- # Scripts don't get the current directory in their path by default.
- scriptdir = os.path.dirname(sys.argv[0])
- if scriptdir in sys.path:
- sys.path.remove(scriptdir)
- sys.path.insert(0, '.')
+ # Scripts don't get the current directory in their path by default
+ # unless they are run with the '-m' switch
+ if '' not in sys.path:
+ scriptdir = os.path.dirname(sys.argv[0])
+ if scriptdir in sys.path:
+ sys.path.remove(scriptdir)
+ sys.path.insert(0, '.')
try:
opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w')
diff --git a/Misc/NEWS b/Misc/NEWS
index e23ab2f96e..2c1f5a79bd 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,8 @@ Core and Builtins
Library
-------
+- Issue #7328: pydoc no longer corrupts sys.path when run with the '-m' switch
+
- Issue #7318: multiprocessing now uses a timeout when it fails to establish
a connection with another process, rather than looping endlessly. The
default timeout is 20 seconds, which should be amply sufficient for