mirror of
https://github.com/python/cpython.git
synced 2025-07-27 13:14:41 +00:00
Make “pydoc somebuiltin.somemethod” work (#8887)
This commit is contained in:
parent
271208e225
commit
9a528306b9
3 changed files with 29 additions and 8 deletions
13
Lib/pydoc.py
13
Lib/pydoc.py
|
@ -1454,13 +1454,14 @@ def locate(path, forceload=0):
|
|||
else: break
|
||||
if module:
|
||||
object = module
|
||||
for part in parts[n:]:
|
||||
try: object = getattr(object, part)
|
||||
except AttributeError: return None
|
||||
return object
|
||||
else:
|
||||
if hasattr(__builtin__, path):
|
||||
return getattr(__builtin__, path)
|
||||
object = __builtin__
|
||||
for part in parts[n:]:
|
||||
try:
|
||||
object = getattr(object, part)
|
||||
except AttributeError:
|
||||
return None
|
||||
return object
|
||||
|
||||
# --------------------------------------- interactive interpreter interface
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue