This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Cannot retrieve name of super object
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: brett.cannon, georg.brandl, georg.brandl, michele_s
Priority: low Keywords:

Created on 2003-04-28 18:47 by michele_s, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Messages (6)
msg15725 - (view) Author: Michele Simionato (michele_s) Date: 2003-04-28 18:47
I see that in Python 2.3b1 many problems of super
have been fixed, but this one is still there:
I cannot retrieve the __name__ of a super object.
This generates problems with pydoc, for instance:

>>> class C(B):
...     sup=super(B)
>>> help(C)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.3/site.py", line 293, in
__call__
    return pydoc.help(*args, **kwds)
  File "/usr/local/lib/python2.3/pydoc.py", line 1539,
in __call__
    self.help(request)
  File "/usr/local/lib/python2.3/pydoc.py", line 1575,
in help
    else: doc(request, 'Help on %s:')
  File "/usr/local/lib/python2.3/pydoc.py", line 1368,
in doc
    pager(title % desc + '\n\n' + text.document(object,
name))
  File "/usr/local/lib/python2.3/pydoc.py", line 279,
in document
    if inspect.isclass(object): return
self.docclass(*args)
  File "/usr/local/lib/python2.3/pydoc.py", line 1122,
in docclass
    lambda t: t[1] == 'method')
  File "/usr/local/lib/python2.3/pydoc.py", line 1057,
in spill
    name, mod, object))
  File "/usr/local/lib/python2.3/pydoc.py", line 280,
in document
    if inspect.isroutine(object): return
self.docroutine(*args)
  File "/usr/local/lib/python2.3/pydoc.py", line 1145,
in docroutine
    realname = object.__name__
AttributeError: 'super' object has no attribute
'__name__'

P.S. I seem to remember I already submitted this
bug (or feature request, as you wish ;) but I don't
find it in bugtracker and I had no feedback; maybe
it wasn't sent at all due to some connection problem.
If not, please accept my apologies.

    Michele Simionato
msg15726 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-06-10 23:44
Logged In: YES 
user_id=357491

The issue is inspect.isroutine is saying that the instance is a 
callable object since it is also a non-data descriptor.
msg15727 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-06-11 23:39
Logged In: YES 
user_id=357491

Patched pydoc (revision 1.84) to try an object as "other" if what 
inspect identifies it as does not work based on its assumptions.
msg15728 - (view) Author: Michele Simionato (michele_s) Date: 2003-08-19 00:23
Logged In: YES 
user_id=583457

I've just checked today with Python 2.3 (pydoc
revision 1.86):

class B(object):
    pass

class C(B):
    sup=super(B)

help(C)

still gives the same error!

What happened? Did you forgot to add the patch to 
the standard distribution? The bug is not close!
msg15729 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-08-28 00:18
Logged In: YES 
user_id=357491

The patch was applied.  It's possible one of the subsequent 
patches broke it.

Opening patch again.
msg15730 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-10-01 16:34
Logged In: YES 
user_id=1188172

Fixed in Lib/pydoc.py r1.107, 1.100.2.5.
History
Date User Action Args
2022-04-10 16:08:25adminsetgithub: 38390
2003-04-28 18:47:53michele_screate