]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-33185: Fix regression in pydoc CLI sys.path handling (GH-6419)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 15 Apr 2018 12:17:13 +0000 (05:17 -0700)
committerGitHub <noreply@github.com>
Sun, 15 Apr 2018 12:17:13 +0000 (05:17 -0700)
commitd7ffa5820733a528d9ab87ee567738e2d3fd7126
treec4661e0bb293be14156690a53146fe4ed0dbdaa8
parentdf958ff28af9c5c4563fd1b050f04f0e9745ab80
bpo-33185: Fix regression in pydoc CLI sys.path handling (GH-6419)

The pydoc CLI assumed -m pydoc would add the empty string
to sys.path, and hence got confused when it switched to
adding the full initial working directory instead.

This refactors the pydoc CLI path manipulation to be
more testable, and ensures it won't accidentally
remove the standard library directory containing
pydoc itself from sys.path.
(cherry picked from commit 82a948105920100ca2ec5c2340bc3890adcfe778)

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
Doc/whatsnew/3.7.rst
Lib/pydoc.py
Lib/test/test_pydoc.py
Misc/NEWS.d/next/Library/2018-04-08-22-54-07.bpo-33185.Id-Ba9.rst [new file with mode: 0644]