bpo-21016: pydoc and trace use sysconfig (GH-18476) · python/cpython@ac6f4d2 · GitHub
Skip to content

Commit ac6f4d2

Browse files
bpo-21016: pydoc and trace use sysconfig (GH-18476)
bpo-21016, bpo-1294959: The pydoc and trace modules now use the sysconfig module to get the path to the Python standard library, to support uncommon installation path like /usr/lib64/python3.9/ on Fedora. Co-Authored-By: Jan Matějek <jmatejek@suse.com> (cherry picked from commit 4fac7ed) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent efd878c commit ac6f4d2

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

Lib/pydoc.py

Lines changed: 2 additions & 3 deletions

Lib/trace.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import linecache
5353
import os
5454
import sys
55+
import sysconfig
5556
import token
5657
import tokenize
5758
import inspect
@@ -676,9 +677,8 @@ def main():
676677
opts = parser.parse_args()
677678

678679
if opts.ignore_dir:
679-
rel_path = 'lib', 'python{0.major}.{0.minor}'.format(sys.version_info)
680-
_prefix = os.path.join(sys.base_prefix, *rel_path)
681-
_exec_prefix = os.path.join(sys.base_exec_prefix, *rel_path)
680+
_prefix = sysconfig.get_path("stdlib")
681+
_exec_prefix = sysconfig.get_path("platstdlib")
682682

683683
def parse_ignore_dir(s):
684684
s = os.path.expanduser(os.path.expandvars(s))
Lines changed: 4 additions & 0 deletions

0 commit comments

Comments
 (0)