[Python-bugs-list] [ python-Bugs-467331 ] ClassType.__doc__ always None
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 03 Oct 2001 22:29:01 -0700
Bugs item #467331, was opened at 2001-10-02 15:22
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=467331&group_id=5470
Category: Python Interpreter Core
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Tim Peters (tim_one)
Summary: ClassType.__doc__ always None
Initial Comment:
The docstring for a new-style class is too hard to dig
out:
>>> class C(object):
... "Hi. I'm C's docstring."
...
>>> C.__doc__ # no luck
>>> getattr(C, "__doc__") # no luck
>>> C.__dict__['__doc__'] # bingo
"Hi. I'm C's docstring."
>>>
Note that in restricted mode, you can't eveb get at
C.__dict__ (but we don't want to hide the docstring,
right?).
If the cause+cure for this isn't instantly known you,
assign it back to me and I'll dig into it.
Note that things like int.__doc__ and file.__doc__
work fine; it appears to be only user-defined types
that suffer here.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-10-03 22:29
Message:
Logged In: YES
user_id=31435
Fixed, in the way you thought it would be:
Lib/test/test_descr.py; new revision: 1.82
Lib/test/test_doctest2.py; new revision: 1.3
Objects/typeobject.c; new revision: 2.87
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-02 16:21
Message:
Logged In: YES
user_id=6380
I'm guessing this is because there's a tp_doc slot in the
type object but that's never assigned to in type_new. Enjoy
learning about type_new!
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=467331&group_id=5470