[ python-Bugs-1705997 ] pydoc.py has typo.

SourceForge.net noreply at sourceforge.net
Mon Apr 23 18:09:27 CEST 2007


Bugs item #1705997, was opened at 2007-04-23 11:09
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1705997&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: charlesmchen (charlesmchen)
Assigned to: Nobody/Anonymous (nobody)
Summary: pydoc.py has typo.

Initial Comment:

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


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1705997&group_id=5470


More information about the Python-bugs-list mailing list