[ python-Bugs-1705997 ] pydoc.py has typo.
SourceForge.net
noreply at sourceforge.net
Tue Apr 24 17:11:33 CEST 2007
Bugs item #1705997, was opened at 2007-04-23 16:09
Message generated for change (Comment added) made by gbrandl
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: Closed
>Resolution: Invalid
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
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2007-04-24 15:11
Message:
Logged In: YES
user_id=849994
Originator: NO
I don't think so. __builtin__ is imported at the top of the module, and
its use is intentional here.
----------------------------------------------------------------------
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