From 6191a23537fbb1bd1c3f6293f502f079a20600ef Mon Sep 17 00:00:00 2001 From: Ka-Ping Yee Date: Fri, 13 Apr 2001 15:00:27 +0000 Subject: [PATCH] Use nturl2path to generate a file: URL to source files in Windows. --- Lib/pydoc.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index ee9177d7e15..eac1767a6dc 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -484,7 +484,11 @@ TT { font-family: lucida typewriter, lucida console, courier } head = '%s' % linkedname try: path = inspect.getabsfile(object) - filelink = '%s' % (path, path) + url = path + if sys.platform == 'win32': + import nturl2path + url = nturl2path.pathname2url(path) + filelink = '%s' % (url, path) except TypeError: filelink = '(built-in)' info = [] @@ -1473,9 +1477,9 @@ class ModuleScanner(Scanner): return children def isnewpackage(self, (dir, package)): - inode = os.stat(dir)[1] # detect circular symbolic links + inode = os.path.exists(dir) and os.stat(dir)[1] if not (os.path.islink(dir) and inode in self.inodes): - self.inodes.append(inode) + self.inodes.append(inode) # detect circular symbolic links return ispackage(dir) def run(self, callback, key=None, completer=None):