[issue16484] pydoc generates invalid docs.python.org link for xml.etree.ElementTree and other modules

Martin Panter report at bugs.python.org
Sat Jun 11 02:03:21 EDT 2016


Martin Panter added the comment:

My guess is the file.startswith(basedir) in the getdocloc() method is getting tricked by non-canonical paths (e.g. lowercase vs uppercase C: drive?). Would it help to use something like os.path.normcase(), or maybe os.path.commonpath(), pathlib.PurePath.parts or PurePath.relative_to()?

file = inspect.getabsfile(object)
...
basedir = os.path.normcase(basedir)
if (...
     (file.startswith(basedir) and ...

Also, in the new get_pydoc_link() function, is that os.path.join() call meant to be there?

basedir = os.path.join(dirname(dirname(__file__)))

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16484>
_______________________________________


More information about the Python-bugs-list mailing list