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>
This commit is contained in:
Victor Stinner 2020-02-12 13:02:29 +01:00 committed by GitHub
parent 8c579b1cc8
commit 4fac7ed43e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View file

@ -66,6 +66,7 @@ import pkgutil
import platform
import re
import sys
import sysconfig
import time
import tokenize
import urllib.parse
@ -392,9 +393,7 @@ class Doc:
docmodule = docclass = docroutine = docother = docproperty = docdata = fail
def getdocloc(self, object,
basedir=os.path.join(sys.base_exec_prefix, "lib",
"python%d.%d" % sys.version_info[:2])):
def getdocloc(self, object, basedir=sysconfig.get_path('stdlib')):
"""Return the location of module docs or None"""
try: