Skip to content

Commit 6dcfa38

Browse files
committed
Fix call to ModuleScanner from GUI search interface.
Fix handling of unbound top-level methods.
1 parent 47f11ce commit 6dcfa38

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Lib/pydoc.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -580,18 +580,19 @@ def docroutine(self, object, name=None, mod=None,
580580
note = ''
581581
skipdocs = 0
582582
if inspect.ismethod(object):
583+
imclass = object.im_class
583584
if cl:
584-
imclass = object.im_class
585585
if imclass is not cl:
586586
url = '%s.html#%s-%s' % (
587587
imclass.__module__, imclass.__name__, name)
588588
note = ' from <a href="%s">%s</a>' % (
589589
url, classname(imclass, mod))
590590
skipdocs = 1
591591
else:
592-
note = (object.im_self and
593-
' method of %s instance' + object.im_self.__class__ or
594-
' unbound %s method' % object.im_class.__name__)
592+
inst = object.im_self
593+
note = (inst and
594+
' method of %s instance' % classname(inst.__class__, mod) or
595+
' unbound %s method' % classname(imclass, mod))
595596
object = object.im_func
596597

597598
if name == realname:
@@ -847,9 +848,10 @@ def docroutine(self, object, name=None, mod=None, cl=None):
847848
note = ' from ' + classname(imclass, mod)
848849
skipdocs = 1
849850
else:
850-
note = (object.im_self and
851-
' method of %s instance' + object.im_self.__class__ or
852-
' unbound %s method' % classname(imclass, mod))
851+
inst = object.im_self
852+
note = (inst and
853+
' method of %s instance' % classname(inst.__class__, mod) or
854+
' unbound %s method' % classname(imclass, mod))
853855
object = object.im_func
854856

855857
if name == realname:
@@ -1699,7 +1701,7 @@ def search(self, event=None):
16991701
self.scanner.quit = 1
17001702
self.scanner = ModuleScanner()
17011703
threading.Thread(target=self.scanner.run,
1702-
args=(key, self.update, self.done)).start()
1704+
args=(self.update, key, self.done)).start()
17031705

17041706
def update(self, path, modname, desc):
17051707
if modname[-9:] == '.__init__':

0 commit comments

Comments
 (0)