
python-checkins at python
Nov 15, 2009, 4:20 PM
Post #1 of 1
(100 views)
Permalink
|
|
r76312 - in python/trunk: Lib/pydoc.py Misc/NEWS
|
|
Author: nick.coghlan Date: Sun Nov 15 23:36:47 2009 New Revision: 76312 Log: Issue #7328: don't corrupt sys.path when running pydoc with the -m switch Modified: python/trunk/Lib/pydoc.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/pydoc.py ============================================================================== --- python/trunk/Lib/pydoc.py (original) +++ python/trunk/Lib/pydoc.py Sun Nov 15 23:36:47 2009 @@ -2254,11 +2254,13 @@ import getopt class BadUsage: 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') Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Nov 15 23:36:47 2009 @@ -429,6 +429,8 @@ Library ------- +- Issue #7328: pydoc no longer corrupts sys.path when run with the '-m' switch + - Issue #2054: ftplib now provides an FTP_TLS class to do secure FTP using TLS or SSL. Patch by Giampaolo Rodola'. _______________________________________________ Python-checkins mailing list Python-checkins [at] python http://mail.python.org/mailman/listinfo/python-checkins
|