Issue1705997
Created on 2007-04-23 16:09 by charlesmchen, last changed 2007-04-24 15:11 by georg.brandl.
| Messages (2) | |||
|---|---|---|---|
| msg31870 - (view) | Author: charlesmchen (charlesmchen) | Date: 2007-04-23 16:09 | |
pydoc.py has typo.
file: C:\Python25\Lib\pydoc.py
method: locate
quote:
def locate(path, forceload=0):
"""Locate an object by name or dotted path, importing as necessary."""
parts = [part for part in split(path, '.') if part]
module, n = None, 0
while n < len(parts):
nextmodule = safeimport(join(parts[:n+1], '.'), forceload)
if nextmodule: module, n = nextmodule, n + 1
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)
bug:
I believe that by '__builtin__' you meant '__builtins__' in the last two lines.
if hasattr(__builtin__, path):
return getattr(__builtin__, path)
should read:
if hasattr(__builtins__, path):
return getattr(__builtins__, path)
>>> sys.platform
'win32'
>>> sys.version
'2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]'
Thanks, Charles
|
|||
| msg31871 - (view) | Author: Georg Brandl (georg.brandl) | Date: 2007-04-24 15:11 | |
I don't think so. __builtin__ is imported at the top of the module, and its use is intentional here. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2007-04-23 16:09:26 | charlesmchen | create | |