[ python-Bugs-729103 ] Cannot retrieve name of super object

SourceForge.net noreply at sourceforge.net
Mon Feb 20 14:13:25 CET 2006


Bugs item #729103, was opened at 2003-04-28 18:47
Message generated for change (Settings changed) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=729103&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: Type/class unification
Group: Python 2.3
Status: Closed
Resolution: Fixed
Priority: 3
Submitted By: Michele Simionato (michele_s)
>Assigned to: Georg Brandl (gbrandl)
Summary: Cannot retrieve name of super object

Initial Comment:
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

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

Comment By: Georg Brandl (birkenfeld)
Date: 2005-10-01 16:34

Message:
Logged In: YES 
user_id=1188172

Fixed in Lib/pydoc.py r1.107, 1.100.2.5.

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

Comment By: Brett Cannon (bcannon)
Date: 2003-08-28 00:18

Message:
Logged In: YES 
user_id=357491

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

Opening patch again.

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

Comment By: Michele Simionato (michele_s)
Date: 2003-08-19 00:23

Message:
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!


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

Comment By: Brett Cannon (bcannon)
Date: 2003-06-11 23:39

Message:
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.

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

Comment By: Brett Cannon (bcannon)
Date: 2003-06-10 23:44

Message:
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.

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

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


More information about the Python-bugs-list mailing list